我想在屏幕右下角的react native android中使用 float 操作按钮。但是我不能这样做。
CreateButton 组件包含 float 按钮代码。我在列表 View 之后调用了CreateButton组件,我想在具有透明覆盖层和右下角固定位置的ListView android组件上显示此按钮。
<DrawerLayoutAndroid
drawerWidth={300}
drawerPosition={DrawerLayoutAndroid.positions.Left}
renderNavigationView={() => navigationView}>
<View style={styles.navBar}>
<TouchableOpacity style={styles.menuIconButton}>
<Image style={styles.menuIcon} source={{uri : 'https://cdn1.iconfinder.com/data/icons/basic-ui-elements-plain/422/ 06_menu_stack-128.png'}}/>
</TouchableOpacity>
<Text style={styles.appName}>LifeMaker</Text>
<TouchableOpacity style={styles.smokeIconButton}>
<Image style={styles.smokeIcon} source={{uri : 'http://avtech.com/images/home/icons/Icon_Smoke_&_Fire.png'}}/>
</TouchableOpacity>
</View>
<ToolbarAndroid
title="AwesomeApp"
onActionSelected={this.onActionSelected}/>
<ListView
dataSource={this.state.dataSource}
renderRow={this._renderSmokeSignals}/>
<CreateButton/> //this is floating button component call
</DrawerLayoutAndroid>
//this is floating button component (<CreateButton>)
<View style={styles.createButton}>
<AccentColoredFab>
<Icon
name='ion|plus'
size={25}
color='#000000'
style={styles.icon}
/>
</AccentColoredFab>
</View>
最佳答案
用底部,左侧,右侧,顶部调整按钮,并为按钮提供绝对位置。
这是我用来制作 float 按钮的代码
width: 60,
height: 60,
borderRadius: 30,
backgroundColor: '#ee6e73',
position: 'absolute',
bottom: 10,
right: 10,
关于react-native - React Native上的 float 操作按钮,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/33135256/