Android 安卓-难以使用75%的屏幕布局

Android 安卓-难以使用75%的屏幕布局,android,layout,android-linearlayout,Android,Layout,Android Linearlayout,现在我有我的应用程序的主屏幕,上面50%的屏幕使用按钮/内容,下面50%只显示徽标。然而,我似乎不能改变它,使标志只占底部25%的屏幕 我在顶部使用了3的布局权重,底部使用了1的布局权重,但是这导致底部徽标现在占据了95%的屏幕区域,并且主区域中的所有内容不再可见。在外部容器中使用weightSum不起作用,也没有将布局\宽度/高度更改为填充\父内容组合或包裹\内容组合 我已经阅读了使用layout_weight的其他帮助线程,并阅读了文档,这一切看起来都非常简单,并且在内容区域中使用了它们,没

现在我有我的应用程序的主屏幕,上面50%的屏幕使用按钮/内容,下面50%只显示徽标。然而,我似乎不能改变它,使标志只占底部25%的屏幕

我在顶部使用了3的布局权重,底部使用了1的布局权重,但是这导致底部徽标现在占据了95%的屏幕区域,并且主区域中的所有内容不再可见。在外部容器中使用weightSum不起作用,也没有将布局\宽度/高度更改为填充\父内容组合或包裹\内容组合

我已经阅读了使用layout_weight的其他帮助线程,并阅读了文档,这一切看起来都非常简单,并且在内容区域中使用了它们,没有任何问题,我不知道为什么这会给我带来麻烦,有人能帮我解决吗

这是我的密码:

<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:orientation="vertical"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:gravity="center_vertical"
android:textColor="#000000"
android:background="#faff67"
>
 <LinearLayout
    android:orientation="vertical"
    android:layout_width="fill_parent"
    android:layout_height="wrap_content"
    android:gravity="center"
    android:background="@drawable/backing"
    android:paddingTop="5dp"
    android:paddingRight="3dp"
    android:paddingLeft="3dp"
    android:paddingBottom="3dp"
    android:layout_margin="3dp"
android:layout_weight="3"
    >

    <!-- Main content area stuff -->


 </LinearLayout>
<LinearLayout
android:id="@+id/main"
android:layout_width="wrap_content" 
android:layout_height="wrap_content"
android:paddingTop="0dp"
android:layout_weight="1"
   >
<ImageView  android:scaleType="fitCenter"
            android:contentDescription="Logo"
            android:src="@drawable/logo"
            android:id="@+id/front_logo"
            android:padding="1sp"
            android:layout_height="fill_parent"
            android:layout_width="fill_parent"></ImageView>
</LinearLayout>
</LinearLayout>

使用
android:layout\u weight
时,应为加权组件设置
android:layout\u height=“0dp”
。否则,在某些情况下,布局高度将超过权重


当然,这是一个垂直布局。对于水平方向,请使用android:layout\u width=“0dp”您错误地使用了权重属性。无论何时设置重量参数,都应将相应的宽度或高度设置为0dp。因此,更改布局的高度,将权重分配给0dp。

android:layout_height="0dp"
用这个

<?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="#faff67"
android:orientation="vertical"
android:textColor="#000000" >

<LinearLayout
    android:layout_width="fill_parent"
    android:layout_height="fill_parent"
    android:layout_weight="1"
    android:background="#123123"
    android:gravity="center"
    android:orientation="vertical" >
</LinearLayout>

<LinearLayout
    android:id="@+id/main"
    android:layout_width="fill_parent"
    android:layout_height="fill_parent"
    android:layout_weight="3" >

    <ImageView
        android:id="@+id/front_logo"
        android:layout_width="fill_parent"
        android:layout_height="fill_parent"
        android:contentDescription="Logo"
        android:padding="1sp"
        android:scaleType="fitCenter"
        android:src="@drawable/logo" >
    </ImageView>
</LinearLayout>

</LinearLayout>

查看此项