新聞中心
標(biāo)準(zhǔn)的 Android 雙態(tài)切換組件

鐘樓網(wǎng)站制作公司哪家好,找創(chuàng)新互聯(lián)!從網(wǎng)頁(yè)設(shè)計(jì)、網(wǎng)站建設(shè)、微信開發(fā)、APP開發(fā)、響應(yīng)式網(wǎng)站設(shè)計(jì)等網(wǎng)站項(xiàng)目制作,到程序開發(fā),運(yùn)營(yíng)維護(hù)。創(chuàng)新互聯(lián)從2013年創(chuàng)立到現(xiàn)在10年的時(shí)間,我們擁有了豐富的建站經(jīng)驗(yàn)和運(yùn)維經(jīng)驗(yàn),來(lái)保證我們的工作的順利進(jìn)行。專注于網(wǎng)站建設(shè)就選創(chuàng)新互聯(lián)。
屬性
disable bool
如果為 true,則該組件不能進(jìn)行交互。
onValueChange function
當(dāng)值發(fā)生變化時(shí)調(diào)用新的值。
testID string
用于在端到端測(cè)試中查找此視圖。
value bool
開關(guān)的布爾值。
其他屬性:
android:showText:設(shè)置on/off的時(shí)候是否顯示文字,boolean
android:splitTrack:是否設(shè)置一個(gè)間隙,讓滑塊與底部圖片分隔,boolean
android:switchMinWidth:設(shè)置開關(guān)的最小寬度
android:switchPadding:設(shè)置滑塊內(nèi)文字的間隔
android:switchTextAppearance:設(shè)置開關(guān)的文字外觀,暫時(shí)沒發(fā)現(xiàn)有什么用…
android:textOff:按鈕沒有被選中時(shí)顯示的文字
android:textOn:按鈕被選中時(shí)顯示的文字
android:textStyle:文字風(fēng)格,粗體,斜體寫劃線那些
android:track:底部的圖片
android:thumb:滑塊的圖片
例子
'use strict';
var React = require('React');
var SwitchAndroid = require('SwitchAndroid');
var Text = require('Text');
var UIExplorerBlock = require('UIExplorerBlock');
var UIExplorerPage = require('UIExplorerPage');
var SwitchAndroidExample = React.createClass({
statics: {
title: '',
description: 'Standard Android two-state toggle component'
},
getInitialState : function() { return {
trueSwitchIsOn: true,
falseSwitchIsOn: false,
colorTrueSwitchIsOn: true,
colorFalseSwitchIsOn: false,
eventSwitchIsOn: false,
};
},
render: function() { return (
">
this.setState({falseSwitchIsOn: value})}
style={{marginBottom: 10}}
value={this.state.falseSwitchIsOn} />
this.setState({trueSwitchIsOn: value})}
value={this.state.trueSwitchIsOn} />
this.setState({eventSwitchIsOn: value})}
style={{marginBottom: 10}}
value={this.state.eventSwitchIsOn} />
this.setState({eventSwitchIsOn: value})}
style={{marginBottom: 10}}
value={this.state.eventSwitchIsOn} />
{this.state.eventSwitchIsOn ? "On" : "Off"}
);
}
});
module.exports = SwitchAndroidExample;
當(dāng)前標(biāo)題:創(chuàng)新互聯(lián)React教程:SwitchAndroid
網(wǎng)站網(wǎng)址:http://www.5511xx.com/article/dhdhsii.html


咨詢
建站咨詢
