我想在React Native中设置右下角宽度固定位置的按钮 .
position: fixed 在React Native中不起作用,ScrollView中的 stickyHeaderIndices 方法不允许将元素放在其他组件上方 .
position: fixed
stickyHeaderIndices
有人已经测试过这个功能吗?
试试这个:
render() { return ( <View style={{flex:1}}> <View style={{borderWidth:1,position:'absolute',bottom:0,alignSelf:'flex-end'}}> <Button title="Press" color="#841584" accessibilityLabel="Press"/> </View> </View> ); }
输出:
<View style={{flex: 1}}> <ScrollView style={{backgroundColor:'yellow'}}> <Text>body</Text> </ScrollView> <View><Text>sticky footer</Text></View> </View>
2 回答
试试这个:
输出: