1

I'm getting an error stating

 "Binary XML file line #8: You must supply a layout_width attribute."

However I already have a layout width specified (fill_parent) so I'm really not sure why this is happening. I'm sure it is something simple I've overlooked - I'm just not sure exactly what that might be.

SOURCE:


<?xml version="1.0" encoding="UTF-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
    android:layout_width="fill_parent"
    android:layout_height="wrap_content"
    android:orientation="vertical" >

    <RelativeLayout>

        <View
            android:layout_width="1dp"
            android:layout_height="5dp" >
        </View>

        <ScrollView
            android:layout_width="fill_parent"
            android:layout_height="wrap_content"
            android:layout_weight="1" >

            <com.google.android.youtube.player.YouTubePlayerView
                android:id="@+id/youtubeplayerview"
                android:layout_width="fill_parent"
                android:layout_height="wrap_content" />

            <View
                android:layout_width="1dp"
                android:layout_height="5dp" >
            </View>

            <TextView
                android:id="@+id/textView1a"
                android:layout_width="wrap_content"
                android:layout_height="wrap_content"
                android:text="Isaac Daniel at CNN Anderson Cooper"
                android:textAppearance="?android:attr/textAppearanceMedium" />

            <TextView
                android:id="@+id/textView2a"
                android:layout_width="wrap_content"
                android:layout_height="wrap_content"
                android:text="by idconex"
                android:textAppearance="?android:attr/textAppearanceSmall" />

            <TextView
                android:id="@+id/textView3a"
                android:layout_width="wrap_content"
                android:layout_height="wrap_content"
                android:text="675,000,000 views"
                android:textAppearance="?android:attr/textAppearanceSmall" />

            <com.google.android.youtube.player.YouTubePlayerView
                android:id="@+id/youtubeplayerview2"
                android:layout_width="fill_parent"
                android:layout_height="wrap_content" />

            <TextView
                android:id="@+id/textView1b"
                android:layout_width="wrap_content"
                android:layout_height="wrap_content"
                android:text="Rage Against The Machine - Bulls on Parade"
                android:textAppearance="?android:attr/textAppearanceMedium" />

            <TextView
                android:id="@+id/textView2b"
                android:layout_width="wrap_content"
                android:layout_height="wrap_content"
                android:text="by RATMVEVO"
                android:textAppearance="?android:attr/textAppearanceSmall" />

            <TextView
                android:id="@+id/textView3b"
                android:layout_width="wrap_content"
                android:layout_height="wrap_content"
                android:text="1,195,601 views"
                android:textAppearance="?android:attr/textAppearanceSmall" />
        </ScrollView>
    </RelativeLayout>

</LinearLayout>
DT7
  • 1,615
  • 14
  • 26
user3009687
  • 369
  • 2
  • 7
  • 17

2 Answers2

4

Your RelativeLayout does not have width & height. Try this:

<RelativeLayout android:layout_width="fill_parent"
    android:layout_height="fill_parent">
pshegger
  • 2,526
  • 24
  • 29
  • That results in Caused by: java.lang.IllegalStateException: ScrollView can host only one direct child – user3009687 Nov 19 '13 at 20:05
  • That's a completely other error, the problem is, that you have more than one elements in your ScrollView. ScrollView can hold only one View, and if you want to add more you have to put them in a ViewGroup (maybe a LinearLayout can solve your problem). – pshegger Nov 19 '13 at 20:08
0

You should give layout height and width

Use this

<RelativeLayout
         android:id="@+id/relativeLayout"
         android:layout_width="match_parent"
         android:layout_height="match_parent">
Gajendra Rawat
  • 3,673
  • 2
  • 19
  • 36