0
我有一個列表視圖的部分包括部分標題,我不想包含容器中的部分內容(每個部分的內容)並添加邊框。這怎麼可能 ?容器listview部分內容反應原生
我有一個列表視圖的部分包括部分標題,我不想包含容器中的部分內容(每個部分的內容)並添加邊框。這怎麼可能 ?容器listview部分內容反應原生
我寫了一個示例代碼,其中有不同的行在listView中的邊界/分隔符。 renderSeparator是您應該查找的功能。希望能幫助到你。
const styles = StyleSheet.create({
separator: {
flex: 1,
height: StyleSheet.hairlineWidth,
backgroundColor: '#8E8E8E',
},
});
class ListViewDemo extends Component {
render() {
return (
<ListView
style={styles.container}
dataSource={this.state.dataSource}
renderRow={(data) => <View><Text>{data}</Text></View>}
renderSeparator={(sectionId, rowId) => <View key={rowId} style=
{styles.separator} />} // See this line. renderSeperator is responsible for providing the border.
/>
);
}
}
但是當它下面有段標題時它不會呈現。 – Bijoy
我不確定你下面的部分標題是什麼意思。但是,如果renderSeperator不適合你。您可以在renderRow函數本身中添加邊框。類似: <查看風格= {} styles.outerBorder> <查看風格= {} styles.actualContent> // UI組件 –
atitpatel