我正试着让我的触手可及的按压有一个边界。我可以这样做,但我正在寻找如何在边框和圆圈之间添加空白。
我现在拥有的是:
colorPicker: {
flex: 4,
flexDirection: 'row',
alignSelf: 'flex-start',
width: '88%',
paddingLeft: 16,
},
circle: {
position: 'relative',
height: 40,
width: 40,
borderRadius: 40,
margin: 10,
borderColor: '#757083',
borderWidth: 2,
}
<View style={styles.colorPicker}>
<TouchableWithoutFeedback
style={[styles.circle, { backgroundColor: '#090C08' }]}
onPress={() => this.setState({ color: '#090C08' })}/>我试过几件事,但没有一件能接近我。有办法增加两个边框吗?我试着用垫子,它什么也不做,我摆弄边缘和半径,但也什么也没有。谢谢你的帮助。
发布于 2020-06-25 13:26:12
我试过用TouchableWithoutFeedback,但没有用。但是,一个可触摸的不透明度可以很容易地样式,所以这是与TouchableOpcity的版本。诀窍是在内部视图中使用,并为外部视图填充或为内部视图设置边距。
<View style={styles.colorPicker}>
<TouchableOpacity
style={{
backgroundColor: 'white',
alignSelf: 'center',
borderRadius: 40,
borderColor: '#757083',
borderWidth: 2,
}}
onPress={() => {}}>
<View style={[styles.circle, { backgroundColor: '#090C08' }]}>
</View>
</TouchableOpacity>
</View>样式
colorPicker: {
flex: 4,
flexDirection: 'row',
alignSelf: 'flex-start',
width: '88%',
paddingLeft: 16,
backgroundColor: 'red',
},
circle: {
position: 'relative',
height: 40,
width: 40,
borderRadius: 40,
margin:5
},https://stackoverflow.com/questions/62576027
复制相似问题