在Android 4.4上,ListView分隔线粗细不一致,有的不渲染。
我看不出这怎么可能是代码问题,这就是我呈现它们的方式:
separator: {
height: 1,
backgroundColor: 'grey',
}
...
<ListView
renderSeparator={(sectionID, rowID) =>
<View key={`${sectionID}-${rowID}`} style={styles.separator} />
}
.../>
这是有此问题的 View 的屏幕截图:
此问题在 iOS 或 Android 6 上不会发生。
以前有人遇到过这个问题吗?
更新
我做了一个测试,这不是Android4的问题。在 Nexus One 设备上运行时,所有 API 版本都会发生这种情况(在 android 模拟器中)
最佳答案
我在 iOS 上遇到了这个问题,并通过添加细线边距来解决它,如下所示:
<View
style={{
...styles,
borderWidth: StyleSheet.hairlineWidth,
margin: StyleSheet.hairlineWidth,
}}
>
{// ...row content}
</View>
关于react-native - React Native ListView 不一致的分隔线,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/38012355/