新聞中心
標準的 Android 雙態(tài)切換組件

鐘樓網(wǎng)站制作公司哪家好,找創(chuàng)新互聯(lián)!從網(wǎng)頁設計、網(wǎng)站建設、微信開發(fā)、APP開發(fā)、響應式網(wǎng)站設計等網(wǎng)站項目制作,到程序開發(fā),運營維護。創(chuàng)新互聯(lián)從2013年創(chuàng)立到現(xiàn)在10年的時間,我們擁有了豐富的建站經(jīng)驗和運維經(jīng)驗,來保證我們的工作的順利進行。專注于網(wǎng)站建設就選創(chuàng)新互聯(lián)。
屬性
disable bool
如果為 true,則該組件不能進行交互。
onValueChange function
當值發(fā)生變化時調(diào)用新的值。
testID string
用于在端到端測試中查找此視圖。
value bool
開關的布爾值。
其他屬性:
android:showText:設置on/off的時候是否顯示文字,boolean
android:splitTrack:是否設置一個間隙,讓滑塊與底部圖片分隔,boolean
android:switchMinWidth:設置開關的最小寬度
android:switchPadding:設置滑塊內(nèi)文字的間隔
android:switchTextAppearance:設置開關的文字外觀,暫時沒發(fā)現(xiàn)有什么用…
android:textOff:按鈕沒有被選中時顯示的文字
android:textOn:按鈕被選中時顯示的文字
android:textStyle:文字風格,粗體,斜體寫劃線那些
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;
分享題目:創(chuàng)新互聯(lián)React教程:SwitchAndroid
本文網(wǎng)址:http://www.5511xx.com/article/dhdhsii.html


咨詢
建站咨詢
