2016-03-21 15 views
1

スティッキーヘッダービューにはスーパーライブラリを使用していますが、header_item.xmlのLinearLayoutやRelativeLayoutなどの他のレイアウトを使用すると、スーパースリムライブラリは、複数のテキストビューを持つヘッダーをサポートしていません

しかし、私はheader_item.xmlで1つのtextviewを使用すると正しく動作しますが、私はそれをしません。私は私を助けview.Please複数でスティッキーヘッダーに変更する必要がどのような

header_item.xml

<LinearLayout 
      android:layout_width="match_parent" 
      android:layout_height="wrap_content" 
      android:orientation="vertical"> 
      <TextView 
       android:id="@+id/post_user_id" 
       android:layout_width="wrap_content" 
       android:layout_height="wrap_content"/> 
      <TextView 
       android:id="@+id/text" 
       android:layout_width="match_parent" 
       android:layout_height="wrap_content" 
       android:background="@color/lightgrey" 
       android:gravity="start" 
       android:layoutDirection="locale" 
       android:padding="10dip" 
       android:textColor="@color/black" 
       android:textDirection="locale" 
       android:textSize="12sp" 
       app:slm_headerDisplay="sticky|inline" 
       app:slm_isHeader="true" 
       app:slm_section_headerMarginStart="56dip" 
       tools:text="Header Item" /> 
</LinearLayout> 

。私はsuperslimライブラリのコーディングを変更せず、ヘッダにmultipleviewを追加しようとします。それは私はそれに複数のビューを追加するときに粘着性を維持します。

+0

あなたが試したコードのいくつかを、libを使って投稿することができます。 –

+0

https://github.com/TonicArtos/SuperSLiM、header_item.xmlのビューを追加するだけです。何もない –

+0

ヘッダ項目にレイアウトを追加する際に問題がありますか? –

答えて

3

header.xmlにレイアウトを追加すると、次のようになります。この方法は私のために働く。

<?xml version="1.0" encoding="utf-8"?> 
<LinearLayout 
      xmlns:android="http://schemas.android.com/apk/res/android" 
      xmlns:app="http://schemas.android.com/apk/res-auto" 
      xmlns:tools="http://schemas.android.com/tools" 
      android:layout_width="wrap_content" 
      android:layout_height="wrap_content" 
      app:slm_headerDisplay="inline|sticky" 
      app:slm_isHeader="true" 
      app:slm_section_headerMarginStart="56dip"> 

    <TextView 
      android:id="@+id/text" 
      android:layout_width="wrap_content" 
      android:layout_height="wrap_content" 
      android:gravity="start" 
      android:padding="16dip" 
      android:layoutDirection="locale" 
      android:textDirection="locale" 
      android:textSize="24sp" 
      tools:text="Header Item" /> 
    <TextView 
      android:id="@+id/post_user_id" 
      android:text="A" 
      android:textSize="20dp" 
      android:layout_width="wrap_content" 
      android:layout_height="wrap_content"/> 

</LinearLayout> 
関連する問題