[android] Fragement替换后不能全屏显示的问题

2017-11-29  本文已影响0人  黑森林中的小木屋

在想替换的布局里的外层包裹FrameLayout然后替换这个FrameLayout

<?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" >

    <FrameLayout
        android:id="@+id/search_activity"
        android:layout_width="match_parent"
        android:layout_height="match_parent"
        android:layout_centerInParent="true"
        android:background="#f00" >

        <RelativeLayout
            android:layout_width="match_parent"
            android:layout_height="match_parent" >

            <Button
                android:id="@+id/search"
                android:layout_width="wrap_content"
                android:layout_height="wrap_content"
                android:layout_centerInParent="true"
                android:text="搜索" />
        </RelativeLayout>
    </FrameLayout>

</RelativeLayout>

测试发现还是能看见,似乎FrameLayout的背景是透明的,加了白色背景后就彻底看不见了

上一篇下一篇

猜你喜欢

热点阅读