【发布时间】:2019-07-06 22:34:56
【问题描述】:
我正在尝试创建 ui 设计,这是我当前的设计:
在此,我有两个矩形的视图,这是我的代码:
<View style={{ flexDirection: 'column', alignContent: 'space-between' }}>
<View style={{ flexDirection: 'row' }}>
<View style={{ width: 100 * 2, height: 100, backgroundColor: 'red'}}/>
</View>
<View style={{ flexDirection: 'row', justifyContent: 'flex-end' }}>
<View style={{ width: 100 * 2, height: 100, backgroundColor: 'red'}}/>
</View>
</View>
预期的输出是第一个矩形应该在左上角(下图看起来是正确的),第二个矩形应该在右下角。但它放置在第一个矩形旁边。
如何移动,矩形到右下角?我尝试了所有方法,例如 justify content ,使用 flex end 但没有任何改变。请帮忙
【问题讨论】:
-
你试过
bottom: 0吗? -
是的,没有任何变化,因为第二个矩形本身就在那里!
标签: react-native user-interface layout flexbox