簡體   English   中英

ListView標頭以奇怪的方式表現

[英]ListView header behaving in strange ways

我已經使用addHeaderView()實現了帶有標題的列表視圖。

標頭是一個簡單的XML:

<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
    xmlns:tools="http://schemas.android.com/tools"
    android:id="@+id/filter_wrapper"
    android:layout_width="match_parent"
    android:layout_height="wrap_content"
    android:orientation="horizontal"
    >

    <TextView
        android:id="@+id/filter_title"
        android:layout_weight="2"
        android:layout_width="0dp"
        android:layout_height="match_parent"
        android:text="Debates"
        android:textSize="18sp" />

    <Spinner
        android:id="@+id/filter"
        android:layout_weight="1"
        android:layout_width="0dp"
        android:layout_height="wrap_content"
        android:layout_gravity="right" />

</LinearLayout>

但是,正如您在這張圖片中看到的

在此處輸入圖片說明

當我向下滾動時,標題會上升,有時會閃爍並下降。 此外,還有一個未在XML中反映的底邊距。

有困難嗎?

初始化適配器后,我立即調用了addHeaderView() 在解決問題之前先調用它。

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM