所以我的抽屉有背景黑色,不透明度为 0.5,它工作正常。我可以看到透明度。现在问题是即使按钮具有我不想要的不透明度,如何将其不透明度重置为 1?我试过 RGBA,仍然不透明度未在本机反应中重置。
<View style={{backgroundColor:'black',opacity:0.5,height:'100%'}}>
<Button backgroundColor:'black',opacity:1>
<Text>Click here </Text>
</Button>
</View>
Run Code Online (Sandbox Code Playgroud) 我想在Android中为我的背景图片添加透明叠加层,如下所示
我的代码
<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent"
tools:context="com.bykar.bykar_provider.WaitingForActivationActivity">
<ImageView
android:layout_width="match_parent"
android:layout_height="match_parent"
android:contentDescription=""
android:scaleType="centerCrop"
android:src="@drawable/map_bg"
tools:ignore="ContentDescription" />
<View
android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="@color/black"
/>
</RelativeLayout>
Run Code Online (Sandbox Code Playgroud) 我想将 Javascript 中变量的值解析为 Reactstyle属性。
但是,似乎只能通过该rgba值添加不透明度?
说我有:
const blueColor = "#2c8da9"
我现在想将它添加到 JSX 中的背景颜色属性中,不透明度为 0.2。我可以用 rgba 做到这一点,但它看起来不太好:
backgroundColor: rgba(blueColor, 0.2)
有没有办法实现相同的目标,直接引用十六进制值而不是使用rgba, 将不透明度直接输入到例如backgroundColor属性中?