0

在下面这段代码中,最底部的线性布局不可见。我尝试了几种方法,但无法使其可见。请看一下

 <?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:background="@color/GlobalBG"
    android:orientation="vertical" >

    <include
        android:id="@+id/id_nav_bar"
        layout="@layout/app_nav_layout" />

    <ListView
        android:id="@+id/id_home_screen_list"
        android:layout_width="fill_parent"
        android:layout_height="wrap_content"
        android:cacheColorHint="@android:color/transparent" />

    <RelativeLayout
        android:id="@+id/id_linear_layout_system_capacity"
        android:layout_width="fill_parent"
        android:layout_height="wrap_content"
        android:layout_marginTop="105dip"
        android:background="@drawable/home_storage_bg"
        android:orientation="vertical" >

        <TextView
            android:layout_width="fill_parent"
            android:layout_height="fill_parent"
            android:layout_marginTop="40dip"
            android:gravity="center_horizontal"
            android:text="Dummy"
            android:textStyle="bold" />

        <LinearLayout
            android:id="@+id/id_linear_layout_seekbar"
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:layout_centerInParent="true"
            android:background="@drawable/home_seekbar_bg" />
    </RelativeLayout>

    <LinearLayout
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:background="@drawable/home_bottom_bg"/ >
    </LinearLayout>
4

3 回答 3

0

你放了

android:layout_width="wrap_content" android:layout_height="wrap_content"

作为 wrap_content 并且您的布局中没有内容,因此它可能不可见

于 2012-10-08T10:38:53.413 回答
0

通过编辑如下代码修复了该问题:-

<TextView
        android:layout_width="fill_parent"
        android:layout_height="wrap_content"
        android:layout_marginTop="17dip"
        android:gravity="center_horizontal"
        android:text="Dummy"
        android:textStyle="bold" />
于 2012-10-08T11:52:01.390 回答
-1

据我了解,这种不可见的布局应该始终在屏幕底部可见,那么您最好使用RelativeLayoutinsted 的LinearLayout 更改此布局

<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="@color/GlobalBG"
android:orientation="vertical" >

TO<RelativeLayout>并将其设置android:layout_alignParentBottom="true"为您的不可见布局

编辑:这对我有用

<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="@color/red" >

<RelativeLayout
    android:id="@+id/id_linear_layout_system_capacity"
    android:layout_width="fill_parent"
    android:layout_height="wrap_content"
    android:layout_marginTop="105dip"
    android:background="@color/row_base_background_end"
    android:orientation="vertical" >

    <TextView
        android:layout_width="fill_parent"
        android:layout_height="fill_parent"
        android:layout_marginTop="20dip"
        android:gravity="center_horizontal"
        android:text="Dummy"
        android:textStyle="bold" />

    <LinearLayout
        android:id="@+id/id_linear_layout_seekbar"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:layout_centerInParent="true"
        android:background="@color/row_base_background_start" />
</RelativeLayout>

<LinearLayout
    android:layout_width="wrap_content"
    android:layout_height="wrap_content"
    android:layout_alignParentBottom="true"
    android:background="@color/gray" >
</LinearLayout>

</RelativeLayout>
于 2012-10-08T11:01:28.900 回答