秀小川 2013-03-01 03:10 采纳率: 88.9%
浏览 2193
已采纳

布局问题,布局类似于下面那张图片.

<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    android:orientation="vertical" >

    <LinearLayout 
        android:layout_width="fill_parent"
        android:layout_height="0dp"
        android:layout_weight="7"
        android:baselineAligned="false">
        <LinerLayout
            android:layout_width="0dp"
            android:layout_height="match_parent"
            android:layout_weight="1"><!-- 问题在这里-->

            <TextView
                android:layout_width="wrap_content"
                android:layout_height="wrap_content"
                android:focusableInTouchMode="false"
                android:text="@string/Subdistrict"/>

            <ListView
                android:id="@+id/Subdistrict"
                android:layout_width="match_parent"
                android:layout_height="match_parent" >     
            </ListView>   

        </LinerLayout>

        <LinerLayout
            android:layout_width="0dp"
            android:layout_height="match_parent"
            android:layout_weight="1">
            <TextView
                android:layout_width="wrap_content"
                android:layout_height="wrap_content"
                android:focusableInTouchMode="false"
                android:text="@string/Building"
                android:textColor="#ffffff"/>
           <ListView
                android:id="@+id/Building"
                android:layout_width="match_parent"
                android:layout_height="match_parent">
           </ListView>
        </LinerLayout>

    </LinearLayout>

    <LinearLayout
        android:layout_width="fill_parent"
        android:layout_height="wrap_content"
        android:gravity="center" >

        <Button 
            android:id="@+id/BuildingSelectOk"
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:text="@string/OK"/>
        <Button 
            android:id="@+id/BuildingSelectCancel"
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:text="@string/Cancel"/>
    </LinearLayout>
</LinearLayout>

CSDN移动问答

两个listview不显示

  • 写回答

2条回答 默认 最新

  • Jobernowl 2013-03-01 03:24
    关注
        <?xml version="1.0" encoding="utf-8"?>
        <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
            android:layout_width="fill_parent"
            android:layout_height="fill_parent"
            android:background="#ffffff"
            android:orientation="horizontal" >
    
            <LinearLayout
                android:layout_width="0dp"
                android:layout_height="fill_parent"
                android:layout_weight="1"
                android:gravity="center_horizontal"
                android:orientation="vertical" >
    
                <LinearLayout
                    android:layout_width="fill_parent"
                    android:layout_height="fill_parent"
                    android:layout_weight="1" >
    
                    <ListView
                        android:layout_width="fill_parent"
                        android:layout_height="fill_parent"
                        android:layout_margin="18dp"
                        android:background="@drawable/stroke_bg" >
                    </ListView>
                </LinearLayout>
    
                <Button
                    android:layout_width="wrap_content"
                    android:layout_height="wrap_content"
                    android:text="button1" />
            </LinearLayout>
    
            <LinearLayout
                android:layout_width="0dp"
                android:layout_height="fill_parent"
                android:layout_weight="1"
                android:gravity="center_horizontal"
                android:orientation="vertical" >
    
                <LinearLayout
                    android:layout_width="fill_parent"
                    android:layout_height="fill_parent"
                    android:layout_weight="1" >
    
                    <ListView
                        android:layout_width="fill_parent"
                        android:layout_height="fill_parent"
                        android:layout_margin="18dp"
                        android:background="@drawable/stroke_bg" >
                    </ListView>
                </LinearLayout>
    
                <Button
                    android:layout_width="wrap_content"
                    android:layout_height="wrap_content"
                    android:text="button2" />
            </LinearLayout>
    
        </LinearLayout>
    
    <?xml version="1.0" encoding="utf-8"?>
    <shape xmlns:android="http://schemas.android.com/apk/res/android"
        android:shape="rectangle" >
        <solid android:color="#00000000"/>
        <stroke
            android:width="1dp"
            android:color="#7F9DB9" />
    
    </shape>
    
    本回答被题主选为最佳回答 , 对您是否有帮助呢?
    评论
查看更多回答(1条)

报告相同问题?

悬赏问题

  • ¥30 python代码,帮调试
  • ¥15 #MATLAB仿真#车辆换道路径规划
  • ¥15 java 操作 elasticsearch 8.1 实现 索引的重建
  • ¥15 数据可视化Python
  • ¥15 要给毕业设计添加扫码登录的功能!!有偿
  • ¥15 kafka 分区副本增加会导致消息丢失或者不可用吗?
  • ¥15 微信公众号自制会员卡没有收款渠道啊
  • ¥100 Jenkins自动化部署—悬赏100元
  • ¥15 关于#python#的问题:求帮写python代码
  • ¥20 MATLAB画图图形出现上下震荡的线条