2017-02-15 83 views
0

我正在开发栅格视图中的示例网格视图项目。我在网格视图中获取两行。但我想显示三行原生反应:如何在网格视图中划分五行?

在这里,这是我的代码:

var CELLS_PER_ROW = 2; 

<GridView 
      key={this.props.key} 
      items={this.state.dataSource} 
      itemsPerRow={CELLS_PER_ROW} 
      renderItem={this.renderItem.bind(this)} 
      style={{padding:15}}/> 

回答

0

只要你想要的行数分配CELLS_PER_ROW。这里是代码

`var CELLS_PER_ROW = 3; // number of rows you want 

<GridView 
      key={this.props.key} 
      items={this.state.dataSource} 
      itemsPerRow={CELLS_PER_ROW} 
      renderItem={this.renderItem.bind(this)} 
      style={{padding:15}}/>` 

希望它适合你:-)。

+0

噢,真的,我感谢您的快速回复 – Lavaraju