我正在使用superslim库进行粘贴标题视图,但是当我在header_item.xml中使用其他布局(如LinearLayout或RelativeLayout)时,它将不会粘贴。
但是当我在header_item.xml中使用单个textview时它会正常工作,但我不知道。
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库的编码只是尝试在header上添加multipleview。但是当我在其上添加多个视图时它会保持粘性。
答案 0 :(得分:3)
您可以在 header.xml 中添加布局,如下面的代码所示。这种方法适合我。
var AreaAdd = {
"Area": Area, "CityID": CityID
};