Closed nathanielwolf closed 9 years ago
Hi,
Can you post an example of a header layout that fail ?
The layout below is from your sample, but with the title TextView width to wrap_content. I also made the background red so I could see that view - it has a width of 0dp so it is not visible.
top_header.xml
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="vertical"
android:paddingStart="@dimen/item_padding"
android:paddingEnd="@dimen/item_padding">
<TextView
android:id="@+id/title"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:gravity="left|center_vertical"
android:textAppearance="?android:textAppearanceMedium"
android:background="#F00"/>
<ImageView
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:src="?android:listDivider"
android:scaleType="fitXY"/>
</LinearLayout>
Any children with width=wrap_content have a size fixed at inflation, even when content is added to them. e.g. a TextView. Calling requestLayout or setLayoutParams with a fixed width also has no effect.