【发布时间】:2018-01-10 11:05:19
【问题描述】:
因为我想将此图标与其他两个视图重叠,如图所示。此代码适用于 IOS 平台,但不适用于 android。请建议是否有任何适用于 Android 的解决方案。
var tabs = ['Activity', 'Files', 'People'];
this.state = {
tabs
};
return (
<Container style={{backgroundColor: '#F5F5F5'}}>
<View style={styles.topStrip}>
{
this.state.tabs.map((tab, index) => (
<View key={index} >
<TouchableOpacity>
<Text style={styles.streamName}>{tab}</Text>
</TouchableOpacity>
</View>
))
}
<View style={{position: 'absolute', backgroundColor: 'transparent', alignItems: 'center', justifyContent: 'center', zIndex: 5, elevation: 24, marginTop: 15, marginLeft: 300}}>
<EIcon size={40} color='#2196f3' name={'circle-with-plus'} />
</View>
</View>
<View style={{zIndex: -1}}></View>
</Container>
);
}
}
const styles = StyleSheet.create({
topStrip: {
alignItems: 'center',
},
streamName: {
marginTop: 7,
marginBottom: 6,
flexDirection: 'row',
alignSelf: 'center'
}
}
});
【问题讨论】:
-
z-index 不是 zIndex
-
@hanslutterf。这是一个 React Native 应用程序,您必须使用 camelCase 而不是连字符来编写 CSS 属性
标签: android css react-native overlap