我有一個布局,類似于頁面。我有一個串列視圖,在串列的底部我需要一個按鈕。它必須在串列視圖下,而不是停留在螢屏底部。(就像您必須一直向下滾動串列才能獲得該按鈕。)我正在使用的結構:
<ScrollView
android:layout_width="match_parent"
android:layout_height="match_parent"
android:fillViewport="true">
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="vertical">
<ListView
android:id="@ id/show_list"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginTop="20dp"
android:dividerHeight="7dp"
android:paddingHorizontal="25dp"
android:scrollbars="none"
android:scrollingCache="false" />
<LinearLayout>
//My button here
</LinearLayout>
</LinearLayout>
</ScrollView>
主要問題:滾動在 ListView 的最后一項結束,Button 留在螢屏外。為什么呢?(我嘗試使用isVerticalScrollBarEnabled禁用串列滾動,但沒有任何區別。)
編輯:現在,當我切換按鈕和串列的順序時,我發現我正在滾動 ListView,而不是 ScrollView,所以問題是我需要滾動 ScrollView,而不是 ListView。怎么做?
uj5u.com熱心網友回復:
所以我發現 ScrollView 中的 ListView 是一個不好的做法,我改用 ListView 頁腳功能,在單獨的布局中有按鈕,然后通過代碼添加它。它完美地作業。
轉載請註明出處,本文鏈接:https://www.uj5u.com/shujuku/438112.html
上一篇:與具有相同ID的另一個標簽沖突
