【问题标题】:Top view and Bottom view heights are fixed, middle view need to fit in remaining space顶视图和底视图高度是固定的,中间视图需要适合剩余空间
【发布时间】:2021-03-26 19:52:45
【问题描述】:

我有 3 个视图 top view、middle view、bottom view。 top view 和 bottom view 有它的组件,它们的高度固定在垂直对齐的 container view 中。现在,我需要middle view 的高度灵活,即middle view 的高度可以根据屏幕高度而变化,它需要适合剩余空间。你能帮我解决这个问题吗?

【问题讨论】:

  • 设置中间视图的高度等于Dimension.get('screen').height - topViewHeight - bottomviewHeight?

标签: react-native view flexbox react-native-stylesheet


【解决方案1】:

这可能会有所帮助

<View style={{flex:1}}>

  <View> ... </View> <!-- Top View ->

  <View style={{flex:1}}> ... </View> <!-- Middle View ->

  <View> ... </View> <!-- Bottom View ->

</View>

【讨论】:

    猜你喜欢
    • 2018-08-03
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2017-12-15
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多