将视图放在Reaction Native中的其他视图之上 [英] Place View on top of other View in React Native

查看:92
本文介绍了将视图放在Reaction Native中的其他视图之上的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想要的是在多个其他视图上显示一行(或视图)。

我已经尝试使用position: absolutez-index,并在代码中最后一处写下我想要的东西。不幸的是,这些都不起作用。我怎样才能把这行放在最上面?

我得到的是:

代码如下:

<ScrollView style={styles.container}>

  <View style={styles.items}>
    {this.state.items.map((item, index) =>
      <View style={styles.item} key={index} elevation={3} />
    }
  </View>

  <View style={styles.line} />

</ScrollView>
const styles = StyleSheet.create({
  container: {
    flex: 1
  },
  row: {
    margin: 10
  },
  line: {
    backgroundColor: 'blue',
    position: 'absolute',
    top: 0,
    bottom: 0,
    left: 80,
    width: 7,
  }

推荐答案

正常,所以我发现问题xD

显然elevation={3}搞砸了。如果我只需从行视图中删除此道具,则一切正常。

这篇关于将视图放在Reaction Native中的其他视图之上的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆