Android 线性布局不可见
在下面的代码中,最底部的线性布局不可见。我尝试了几种方法,但无法使其可见。请看一看Android 线性布局不可见,android,layout,Android,Layout,在下面的代码中,最底部的线性布局不可见。我尝试了几种方法,但无法使其可见。请看一看 <?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" a
<?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>
您已将
android:layout_width="wrap_content" android:layout_height="wrap_content"
作为包装内容,您的布局中没有内容,因此它不可见可能据我所知,这种不可见的布局应该在屏幕底部始终可见,那么您最好使用
相对布局
而不是线性布局
更改此布局
<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" >
通过如下编辑代码修复了此问题:-
<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" />
情况并非如此。如果有背景,则布局将可见。我尝试将TextView的高度设置为“包裹内容”或任何最小高度,而不是“填充”works@Hari...Yes这很有帮助…但它会在文本视图中隐藏文本。。。你知道怎么调整吗?hmmm根据你的要求将文本视图的填充设置为10dp或更大。我调整了边距以便对齐文本…因此错误已经修复。。谢谢你,哈里。。
<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" />