父母和孩子的本机风格不透明度 [英] react-native style opacity for parent and child

查看:37
本文介绍了父母和孩子的本机风格不透明度的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

react-native :我有一个 View 并且 View 的孩子是一个 Image ,我为 View 应用了不透明度:0.5,对于图像应用了不透明度:0.9 但它不适用于 Image ,父不透明度正在申请孩子,孩子不采取独立的不透明度

react-native : I have one View and the child of View is an Image , I applied opacity: 0.5 for View and opacity: 0.9 for an Image but it doesn't apply for Image ,the parent opacity is applying for child , the child doesn't take independent opacity

推荐答案

尝试使用背景颜色的 alpha 值更改不透明度.那么应该可以为儿童应用不同的不透明度.

Try changing the opacity using alpha-value of the background color instead. Then it should be possible applying different opacities for children.

例如:

<View style={{backgroundColor: 'rgba(0,0,0,0.5)'}}/>

这篇关于父母和孩子的本机风格不透明度的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆