我尝试做很多事情:设置 alpha 值,设置背景:透明度,设置背景不同的颜色,如“#90000000”,我什至在我的 recilerView 上方创建了另一个具有透明度的 View 。但我总是有一个结果:
(不要看白图,我稍后会设置)
我需要这样的透明度:
如您所见,图像和线条不处于透明状态。您有任何解决办法吗?
最佳答案
我认为你在root前面声明了RecyclerView, 如果您在 xml 布局中使用像主视图这样的relativelayout,则必须确保您的透明 View 位于 RecyclerView 下方,这是一个示例:
<小时/><RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent" android:layout_height="match_parent">
<RecyclerView
android:layout_width="match_parent"
android:layout_height="match_parent">
</RecyclerView>
<FrameLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="#9A000000">
</FrameLayout>
关于java - 如何将较暗的透明度添加到我的相对布局中,如图所示?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/58187305/