問題:tabhost固定在底部,某個tab中存在Listview,運行起來後發現如果listview中的列表內容比較多(超過一屏時),就會出現部分內容被tabhost遮蓋了。
原Listview佈局文件
<ListView android:id="@+id/listBudgetSet" android:layout_width="match_parent" android:layout_height="wrap_content" android:layout_marginLeft="4dp" android:layout_marginRight="4dp"> </ListView>
後來經過多次調試,發現可以通過配置Listview解決這個問題,下面是重新配置listview的:
在<ListView>中加上android:layout_weight="1" ,並且在listview的下方加一個佈局,這是用於留出tabhost顯示的空間(也就是讓listview的滾動條增長70dp)
<ListView android:id="@+id/listBudgetSet" android:layout_width="match_parent" android:layout_height="wrap_content" android:layout_marginLeft="4dp" android:layout_marginRight="4dp" android:layout_weight="1"> </ListView> <LinearLayout android:id="@+id/budgetLT" android:orientation="horizontal" android:layout_width="match_parent" android:layout_height="70sp" > </LinearLayout>
重新設置後,滾動條明顯b變長了,下方被遮蓋的也顯示出來了,問題解決~~~
不過在代碼那邊我也有做處理,爲了是讓這個界面適用不同的oncreate入口,就需要判斷隱藏或顯示listview下方的佈局,這裏就不貼代碼了,定義一個全局靜態變量,控制LinearLayout顯示或隱藏就ok了。