react-native - React Native Flex 布局与绝对大小
问题描述
我定义了以下用于 React Native 应用程序的 flex 布局(请原谅丑陋的背景颜色):
const master = StyleSheet.create({
component: {
flex: 1,
backgroundColor: "#ff69b4",
},
topSection: {
//flex: 1,
},
bottomSection: {
//flex: 2,
justifyContent: "flex-end",
backgroundColor: "white",
height: 50,
}
});
我需要底部为绝对高度(例如 50 像素),顶部填充所有其他空间,以便我可以在那里放置一些菜单图标。
任何人都可以帮忙吗?
解决方案
这符合您的要求吗?
component: {
flex: 1,
backgroundColor: '#ff69b4'
},
bottomSection: {
justifyContent: 'flex-end',
backgroundColor: 'white',
height: 50,
},
topSection: {
flex: 1
}
假设component
是容器,比如
<View style={styles.component}>
<View style={styles.topSection} />
<View style={styles.bottomSection} />
</View>
或者看看这个小吃
推荐阅读
- kdb - KDB:如何使用列表搜索表
- export - Vertica 不会将所有无限制子句的数据导出到镶木地板
- scala - 读取 Avro 文件时不是数据文件错误
- shell - 使用 shell 脚本获取每行中存在的文件的文件扩展名
- python - 如何将多个相同大小的 pandas 数据框合并到一个内聚数据库中?
- wordpress - 从 WordPress 对象中检索 post_title
- javascript - 稍后或单击时加载叠加层
- datatable - 当标题包含选择菜单时,数据表 excel 导出按钮无法正常工作
- qt - Doxygen 不生成 Qt 压缩帮助文件
- kubernetes - MQ 连接被拒绝