要在FrameLayout中初始隐藏视图,请设置视图的visibility属性为GONE。

例如,如果您要隐藏一个ImageView,您可以像下面这样设置它的visibility属性:

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

    <ImageView
        android:id="@+id/my_imageview"
        android:layout_width="match_parent"
        android:layout_height="match_parent"
        android:src="@drawable/my_image"
        android:visibility="gone" />

</FrameLayout>

在上面的代码中,ImageView的visibility属性被设置为“gone”,这意味着它在FrameLayout中初始时是隐藏的。当您想要显示ImageView时,只需要将它的visibility属性设置为“visible”即可

FrameLayout初始隐藏

原文地址: https://www.cveoy.top/t/topic/hpBS 著作权归作者所有。请勿转载和采集!

免费AI点我,无需注册和登录