簡體   English   中英

ScrollView嵌套ListView和ListView上方的TextView,並且textview將滾動到屏幕外

[英]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.

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