[英]ScrollView nest ListView,and TextView above ListView, and the textview will be scrolled out of screen
<ScrollView
android:layout_width="match_parent"
android:layout_height="wrap_content">
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="vertical">
<TextView
android:layout_width="match_parent"
android:layout_height="50dp" />
<ListView
android:layout_width="match_parent"
android:layout_height="wrap_content">
</ListView>
</LinearLayout>
</ScrollView>
像上面的xml文件。當ListView超出屏幕高度時,TextView將滾動到屏幕外。
如果將ListView可聚焦設置為false可以解決問題,但是我想知道原因
請訪問有關我的問題的視頻請訪問https://goo.gl/iEslpl
問題在於,因為它們都位於相同的線性布局中。因此,它被推出了。
嘗試使用另一個linearlayout嵌套滾動視圖,然后在其中使用另一個linearlayout。
像....線性->滾動->再次線性....
希望對您有所幫助。
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.