hip*_*pie 1 android android-scrollview react-native
我试图在 ReactNative 的 View 中创建一个滚动视图。由于某种原因,我无法在 ScrollView 中滚动。
render() {
return (
<View>
<View>
<Text>Top</Text>
</View>
<ScrollView >
<Text>Line 1</Text>
<Text>Line 2</Text>
<Text>Line 3</Text>
<Text>Line 4</Text>
<Text>Line 5</Text>
<Text>Line 6</Text>
<Text>Line 7</Text>
...
</ScrollView>
</View>
);
}
Run Code Online (Sandbox Code Playgroud)
这里有什么问题吗?我在 Android 上测试
谢谢,马格努斯
小智 5
您应该给 ScrollView 一个高度。来自文档中的示例;
<ScrollView style={styles.scrollView}>
...
...
var styles = StyleSheet.create({
scrollView: {
height: 300,
},
});
Run Code Online (Sandbox Code Playgroud)
| 归档时间: |
|
| 查看次数: |
3712 次 |
| 最近记录: |