我使用FlatList在两列中显示项目列表
<FlatList style={{margin:5}}
data={this.state.items}
numColumns={2}
keyExtractor={(item, index) => item.id }
renderItem={(item) => <Card image={item.item.gallery_image_url} text={item.item.name}/> }
/>
卡片组件只是一个带有一些样式的视图:
<View style={{ flex: 1, margin: 5, backgroundColor: '#ddd', height: 130}} ></View>
它工作得很好,但如果项目的数量是奇数,最后一行只包含一个项目,该项目将延伸到整个屏幕的宽度。
如何将该项目设置为与其他项目相同的宽度?
https://stackoverflow.com/questions/43502954
复制相似问题