2017-06-16 100 views
0

我試圖讓按鈕如截圖所示。但無法弄清楚如何讓它們看起來半透明。如何使用native-base在react-native中爲圖像製作半透明按鈕?

import React, { Component } from 'react'; 
import {Image} from 'react-native'; 
import {Button, Content} from 'native-base'; 

export default class AppBody extends Component { 
    render() { 
     return (
      <Content> 

       <Image source={require('./img/bg3.jpg')} style={{ width: 360, height: 509 }}> 




       </Image> 
      </Content> 
     ); 
    } 
}; 

enter image description here

+0

試試這個:https://stackoverflow.com/questions/31336569/how-to-set-background-color-of-view-transparent –

+0

感謝您的幫助!這工作正常, –

+0

偉大。我將它添加到答案部分。你可以標記已解決:) –

回答

0

爲backgroundColoras使用RGBA值如下:

backgroundColor: 'rgba(52, 52, 52, 0.8)' 

此將其設置爲一灰色的顏色,用80%的不透明度,這是從所述不透明度小數衍生,0.8 。該值可以是0.0到1.0之間的任何值。

複製自this answer