eowise / recyclerview-stickyheaders

DEPRECATED. Android library that integrate sticky section headers in your RecyclerView
http://eowise.github.io/recyclerview-stickyheaders
MIT License
961 stars 148 forks source link

Header View children cannot be resized #7

Closed nathanielwolf closed 9 years ago

nathanielwolf commented 9 years ago

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.

leruaa commented 9 years ago

Hi,

Can you post an example of a header layout that fail ?

nathanielwolf commented 9 years ago

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>