我想知道如何为布局文件中的所有内容添加灰色覆盖,以便查看布局中的所有内容,但是启用了该灰色透明覆盖。
我试图将a View设置为backgroundlike #80000000,但是看起来这View 占用了所有空间(LinearLayout实际上我在使用a )。
相反,我希望此覆盖层覆盖所有其他视图,但仍然希望能够看到其背后的内容。
达到效果的方法之一是使用<FrameLayout>容器作为根。您可以在其中添加当前布局以及带有背景的视图。在这里,view应该覆盖整个屏幕。因此,您的布局将类似于:
<FrameLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="match_parent">
<!-- Your current layout here -->
<!-- View to cover your screen -->
<View
android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="@android:color/black" />
</FrameLayout>
Run Code Online (Sandbox Code Playgroud)
| 归档时间: |
|
| 查看次数: |
1092 次 |
| 最近记录: |