在用RN寫頁面UI的時(shí)候,需要個(gè)背景透明文字不透明的 登錄/注冊(cè)控件,如下圖

首頁的登錄注冊(cè)按鈕
這是它的節(jié)點(diǎn)結(jié)構(gòu):

節(jié)點(diǎn)結(jié)構(gòu)
節(jié)點(diǎn)的style:
login:{
? ? zIndex:999,
? ? width:70,
? ? height:24,
? ? position:'absolute',
? ? right:15,
? ? top:30,
? ? backgroundColor:'rgba(178,178,178,0.5)',
? ? borderRadius:3,
? ? justifyContent: 'center',
? },
? loginText:{
? ? fontSize:14,
? ? color:'white',
? ? height:24,
? ? textAlign:'center',
? ? lineHeight:24,
? ? opacity:1.0
? },
設(shè)置如上控件的要點(diǎn):必須設(shè)置父節(jié)點(diǎn)的 backgroundColor:'rgba(178,178,178,0.5)',必須使用rgba設(shè)置顏色樣式
不能用16進(jìn)制的顏色設(shè)置,否則會(huì)使得文字也改變了透明度