0

我有一个 MainLayout,在 Mainlayout 里面我有 TabWidget 和一个线性布局视图。
在某个特定点,我想显示一个将填满整个屏幕的框架布局(隐藏 TabWidget 和线性布局视图)

如何为 framelayout 设置大小/布局参数,使其显示在整个屏幕上

4

3 回答 3

0

您应该在主布局之上添加另一层 FrameLayout,并添加一个具有 visibility="gone" 的附加 FrameLayout

<?xml version="1.0" encoding="utf-8"?>
<FrameLayout
    android:layout_width="match_parent"
    android:layout_height="match_parent">

    <LinearLayout
        android:id="@+id/main_layout"
        android:layout_width="match_parent"
        android:layout_height="match_parent"
        android:orientation="vertical" >    
        ...    
    </LinearLayout>

    <FrameLayout
        android:id="@+id/occasional_layout"
        android:layout_width="match_parent"
        android:layout_height="match_parent" 
        android:visibility="gone"
        >    
        ...    
    </FrameLayout>
</FrameLayout>
于 2016-10-19T07:05:52.797 回答
-1

您应该将 MainLayout 设为 RelativeLayout,在其中放置 TabWidget 和 LinearLayout,最后放置与父级宽度和高度匹配且可见性消失的 FrameLayout。

于 2013-07-24T09:56:20.800 回答
-2

您可能需要在布局文件的 MainLayout 之外添加一个 FrameLayout,然后添加一个 LinearLayout/FrameLayout

android:layout_width="match_parent",android:layout_height="match_parent"

在主布局之后。

现在您可以通过控制 LinearLayout/FrameLayout 的可见性来隐藏 MainLayout 的内容。

于 2013-07-24T09:58:10.957 回答