简体   繁体   English

React Native - 具有透明背景的 WebView

[英]React Native - WebView with Transparent background

Is it an option to set transparent background to WebView element?是否可以选择为 WebView 元素设置透明背景?

<View>
   <WebView source={{uri: 'https://www.demo.io'}} style={{ backgroundColor:'transparent'}}/>
</View>

My HTML do ave transparent background, but it seems that the web view is still not transparent我的 HTML 确实有透明背景,但网络视图似乎仍然不透明

Yes it works if you put style={{ backgroundColor:'transparent'} both in WebView and in the parent View是的,如果您将style={{ backgroundColor:'transparent'}放在 WebView 和父视图中,它会起作用

<View style={{ backgroundColor:'transparent'}}>
  <WebView 
     source={{uri: 'https://www.demo.io'}} 
     style={{ backgroundColor:'transparent'}}
  />
</View>

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM