Warning: file_get_contents(/data/phpspider/zhask/data//catemap/3/android/186.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Android 无法用线性布局填充空白_Android - Fatal编程技术网

Android 无法用线性布局填充空白

Android 无法用线性布局填充空白,android,Android,我正在使用线性布局设计屏幕。屏幕看起来像: 正如您在上次布局后看到的,出现了一些空白,我无法删除它们 守则: <FrameLayout android:layout_width="match_parent" android:layout_height="wrap_content" app:layout_scrollFlags="scroll">

我正在使用线性布局设计屏幕。屏幕看起来像:

正如您在上次布局后看到的,出现了一些空白,我无法删除它们

守则:

        <FrameLayout
                android:layout_width="match_parent"
                android:layout_height="wrap_content"
                app:layout_scrollFlags="scroll">

            <LinearLayout
                android:id="@+id/menu_absent_container"
                android:layout_width="match_parent"
                android:layout_height="match_parent"
                android:background="@color/black"
                android:layout_marginLeft="4dp"
                android:layout_marginRight="4dp"
                android:layout_marginTop="4dp"
                android:layout_marginBottom="4dp"
                android:padding="8dp"
                android:visibility="gone"
                android:gravity="center_horizontal"
                android:orientation="vertical">

                <TextView
                    android:id="@+id/message"
                    style="@style/BodyStrong"
                    android:layout_width="wrap_content"
                    android:layout_height="wrap_content"
                    android:gravity="left"
                    android:padding="8dp"
                    android:textColor="@color/white"
                    android:text="@string/default_store_message"
                    />

                <Button
                    android:id="@+id/navigate_default_menu"
                    style="@style/BodySmall"
                    android:layout_width="180dp"
                    android:layout_height="wrap_content"
                    android:layout_marginTop="8dp"
                    android:padding="4dp"
                    android:text="@string/default_menu"
                    android:contentDescription="@string/profile_allergies_chart"
                    android:textColor="@color/white_65_opacity"
                    android:background="@drawable/fav_box"
                    tools:ignore="MissingPrefix" />

                <Button
                    android:id="@+id/navigate_location"
                    style="@style/BodySmall"
                    android:layout_width="180dp"
                    android:layout_height="wrap_content"
                    android:layout_marginTop="8dp"
                    android:padding="4dp"
                    android:text="@string/location_search"
                    android:contentDescription="@string/profile_allergies_chart"
                    android:textColor="@color/white_65_opacity"
                    android:background="@drawable/fav_box"
                    tools:ignore="MissingPrefix" />

            </LinearLayout>

            <android.support.v7.widget.RecyclerView
                android:id="@+id/sub_menus"
                android:layout_width="match_parent"
                android:layout_height="wrap_content"
                android:visibility="gone"
                android:background="@drawable/backgroundwhite"
                android:padding="2dp" />

            </FrameLayout>

请注意,还有一个“回收者”视图。但它是隐藏的。我不认为这是问题的原因

如何删除空白并进行线性布局以占用剩余空间


编辑:将框架布局宽度更改为“匹配父项”不起作用

您的
框架布局
已打开
包装内容

试试这个:

    <FrameLayout
            android:layout_width="match_parent"
            android:layout_height="match_parent"
            app:layout_scrollFlags="scroll">


将框架布局中的android:layout\u height=“wrap\u content”更改为
android:layout\u height=“match\u parent”
以垂直填充所有空间,然后执行任何其他所需更改,使嵌套布局看起来更美观。

尝试更改父级
框架布局属性

来自

android:layout\u height=“wrap\u content”


android:layout\u height=“match\u parent”
您应该将您的
FrameLayout
height
属性从
wrap\u content
更改为
match\u parent

由于
wrap_内容
只占用
内容所需的空间
而不是整个
活动
空间

              <FrameLayout
                android:layout_width="match_parent"
                android:layout_height="wrap_content"
                app:layout_scrollFlags="scroll">

更改:-

              <FrameLayout
                android:layout_width="match_parent"
                android:layout_height="match_parent"
                app:layout_scrollFlags="scroll">

我认为这不是一个完整的布局。如果framenlayout中的
匹配\u parent
不起作用,则在level Upper frame中肯定有什么东西,是什么锁定了它。