【问题标题】:listView inside of a linear layout with something else线性布局内的 listView 和其他东西
【发布时间】:2014-04-10 02:15:20
【问题描述】:

我只是想知道是否有可能在一个布局 xml 文件中,也许顶部的垂直线性布局有一个水平线性布局,然后在其下方(垂直布局内部)有一个列表视图,占据屏幕的其余部分?

我找不到任何具体的信息,我想在尝试之前知道它是否可能,谢谢!

【问题讨论】:

    标签: android android-layout


    【解决方案1】:

    给 ListView layout_height="0dp"layout_weight="1"。它将占用未使用的剩余空间购买兄弟LinearLayout。

    <LinearLayout 
        android:layout_width:match_parent
        android:layout_height:match_parent
        android:orientation:vertical >
    
        <LinearLayout
            android:layout_width:match_parent
            android:layout_height:wrap_content
            android:orientation:norizontal >
    
        <!-- other views --->
    
        </LinearLayout>
    
        <ListView
            android:layout_width:match_parent
            android:layout_height:0dp
            android:layout_weight:1 />
    
    </LinearLayout>
    

    【讨论】:

    • 谢谢,我想会是这样,但不确定。欣赏它
    猜你喜欢
    • 2011-08-24
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2019-07-20
    • 2015-05-24
    • 2016-01-22
    相关资源
    最近更新 更多