2017-02-15 55 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