react native ProgressBarAndroid 使用详解
来源:互联网 发布:pc端软件下载 编辑:程序博客网 时间:2024/06/07 12:03
ProgressBarAndroid:android进度条
View props:可以使用View的所有属性
color:进度条颜色
indeterminate:是否要显示一个不确定的进度
progress:当前的进度值(在0到1之间)。
styleAttr:进度条的样式 Horizontal、Small、Large、Inverse、SmallInverse、LargeInverse
/** * Created by on 2017/5/17. */import React, {Component} from 'react';import { StyleSheet, View, ProgressBarAndroid, Text, Button,} from 'react-native';export default class ProgressBarAndroidDemo extends Component { static navigationOptions = { title: 'ProgressBarAndroid', }; componentDidMount() { setInterval(() => { if (this.state.progress >= 1) { this.setState({progress: 0}) } else { this.setState({progress: this.state.progress + 0.1}) } }, 500) } state = { color: 'red', indeterminate: true, progress: 0, styleAttr: 'Large', } render() { return ( <View style={{flex:1}}> <View style={{flexDirection:'row',alignItems:'center'}}> <Text>设置color:</Text> <Button title='red' onPress={()=>{this.setState({color:'red'})}}/> <Button title='blue' onPress={()=>{this.setState({color:'blue'})}}/> </View> <ProgressBarAndroid indeterminate={false} color={this.state.color} progress={this.state.progress} styleAttr='Horizontal'/> <View style={{flexDirection:'row',alignItems:'center',flexWrap:'wrap'}}> <Text>Horizontal</Text> <ProgressBarAndroid styleAttr='Horizontal'/> </View> <View style={{flexDirection:'row',alignItems:'center',flexWrap:'wrap'}}> <Text>Small</Text> <ProgressBarAndroid styleAttr='Small'/> </View> <View style={{flexDirection:'row',alignItems:'center',flexWrap:'wrap'}}> <Text>Large</Text> <ProgressBarAndroid styleAttr='Large'/> </View> <View style={{flexDirection:'row',alignItems:'center',flexWrap:'wrap'}}> <Text>Inverse</Text> <ProgressBarAndroid styleAttr='Inverse'/> </View> <View style={{flexDirection:'row',alignItems:'center',flexWrap:'wrap'}}> <Text>SmallInverse</Text> <ProgressBarAndroid styleAttr='SmallInverse'/> </View> <View style={{flexDirection:'row',alignItems:'center',flexWrap:'wrap'}}> <Text>LargeInverse</Text> <ProgressBarAndroid styleAttr='LargeInverse'/> </View> </View> ); }}
github下载地址
阅读全文
0 0
- react native ProgressBarAndroid 使用详解
- React Native控件学习之ProgressBarAndroid讲解
- 【React Native开发】React Native控件之ProgressBarAndroid进度条讲解(12)
- react native ActivityIndicator使用详解
- react native Button 使用详解
- react native Text 使用详解
- react native Switch使用详解
- react native ScrollView 使用详解
- react native FlatList 使用详解
- react native SectionList 使用详解
- react native TextInput 使用详解
- react native Slider 使用详解
- react native StatusBar 使用详解
- react native DatePickerIOS 使用详解
- react native DrawerLayoutAndroid 使用详解
- react native Image 使用详解
- react native Modal 使用详解
- react native Picker 使用详解
- C# WinForm开发系列
- linux菜鸟日记
- mysql分表的3种方法
- 动态链接库vs无法启动程序 因为计算机中丢失zsKernel.dll
- WebSocket学习笔记
- react native ProgressBarAndroid 使用详解
- JAEE学习笔记(18)_jdbc篇
- 二维数组和二级指针
- C语言基础及指针②之指针内存分析
- 最小费用流算法不完全指南-2017华为软件精英挑战赛
- /usr/lib/libstdc++.so.6: version `GLIBCXX_3.4.15' not found错误的解决
- 388. Longest Absolute File Path
- 使用POI读写word doc文件
- 微信小程序商品循环列表点击弹出当前的商品信息