Android 半透明布局 XML 代码示例
<LinearLayout
android:layout_width='match_parent'
android:layout_height='match_parent'
android:background='@android:color/transparent'
android:orientation='vertical'>
<!-- Add your content here -->
</LinearLayout>
<View
android:layout_width='match_parent'
android:layout_height='match_parent'
android:background='#80000000' />
这个 XML 文件创建了一个 RelativeLayout 作为根布局,其中包含一个垂直方向的 LinearLayout 用于放置内容。LinearLayout 的背景设置为透明。另外,通过添加一个 View,设置其宽度和高度与 RelativeLayout 相等,并将背景颜色设置为半透明的黑色 (#80000000),实现了半透明效果。你可以在 LinearLayout 中添加你自己的内容。
原文地址: https://www.cveoy.top/t/topic/qcCd 著作权归作者所有。请勿转载和采集!