Reputation: 44230
I'm stumped, I've already deduced it to being within this merge section of the larger layout (edit thanks, yes line #10 was sort of obvious, the textview on line 10 clearly needed the width and height, but there were no crashes using just textview that exists further in the code, which I had pasted into line #10)
<merge xmlns:android="http://schemas.android.com/apk/res/android" android:layout_width="wrap_content" android:layout_height="wrap_content" android:id="@+id/frameLayoutLatest">
<LinearLayout android:id="@+id/subLinLayoutHeader" android:orientation="horizontal" android:layout_gravity="center_horizontal" android:layout_width="wrap_content" android:layout_height="wrap_content">
<ImageView android:src="@drawable/layouttriangle" android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_gravity="center_horizontal"></ImageView>
</LinearLayout>
<TableLayout android:id="@+id/subLinLayout" android:layout_below="@id/subLinLayoutHeader" android:layout_width="wrap_content" android:layout_height="wrap_content">
<TableRow android:layout_width="wrap_content" android:layout_height="wrap_content">
<LinearLayout android:layout_width="wrap_content" android:layout_height="wrap_content" android:orientation="vertical">
<ScrollView android:layout_width="wrap_content" android:layout_height="wrap_content">
<!-- list view goes here -->
<TextView android:layout_gravity="center_vertical|center_horizontal" android:text="Dummy text" android:textColor="#ffffff" android:textSize="16dip"></TextView>
</ScrollView>
</LinearLayout>
</TableRow>
<TableRow android:layout_width="wrap_content" android:layout_height="wrap_content">
<LinearLayout android:layout_width="wrap_content" android:layout_height="wrap_content">
<TableLayout android:layout_width="wrap_content" android:layout_height="wrap_content">
<TableRow android:layout_width="wrap_content" android:layout_height="wrap_content">
<TextView android:layout_gravity="center_vertical|center_horizontal" android:text="Latest Articles" android:textColor="#ffffff" android:textSize="16dip"></TextView>
</TableRow>
</TableLayout>
<ScrollView android:layout_width="wrap_content" android:layout_height="wrap_content">
<!-- list view goes here -->
</ScrollView>
</LinearLayout>
</TableRow>
</TableLayout>
Where's waldo?
Upvotes: 0
Views: 1641
Reputation: 8719
On line 10 of course :) Your code doesn't supply a layout_height or a layout_width for the TextView. Both are required for every xml element.
This is your code:
<TextView
android:layout_gravity="center_vertical|center_horizontal"
android:text="Dummy text"
android:textColor="#ffffff"
android:textSize="16dip">
</TextView>
Try this instead (or use match_parent instead of wrap_content)
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center_vertical|center_horizontal"
android:text="Dummy text"
android:textColor="#ffffff"
android:textSize="16dip">
</TextView>
EDIT to explain second TextView's behavior
Well, I learned something new today. According to the TableRow documentation,
The children of a TableRow do not need to specify the layout_width
and layout_height attributes in the XML file. TableRow always enforces
those values to be respectively MATCH_PARENT and WRAP_CONTENT.
That's why it didn't throw an error.
Upvotes: 3
Reputation: 9189
Your TextView in the ScrollView of line 10 of this file requires a layout_height and layout_width attribute so the system will know the dimensions you would like your TextView to be. If you're not sure where to start just copy the two attributes from the ScrollView that contains it.
Upvotes: 2
Reputation: 5371
Isn’t the error message clear enough? Something is missing a layout width (the two TextView
), your problem will probably be fixed if you fix this.
Upvotes: 1