Pon*_*ony 6 scrollview react-native
在android上,当我将边框半径应用于滚动视图时,内部容器会忽略外边框半径,我无法弄清楚如何使其符合。这是在 Pixel 2 模拟器上,红色虚线显示了底层边界半径和重叠的位置。代码只是一个标准的滚动视图,我用来仔细检查它发生在它所做的最简单的滚动视图实现上。
<ScrollView
contentContainerStyle={{
alignItems: 'center',
justifyContent: 'space-between',
}}
style={{
padding: 20,
backgroundColor: 'green',
borderTopLeftRadius: 45,
borderTopRightRadius: 45,
}}>
<View
style={{
width: '100%',
height: 400,
borderRadius: 20,
backgroundColor: 'red',
}}
/>
<View
style={{
width: '100%',
height: 400,
borderRadius: 20,
backgroundColor: 'red',
}}
/>
<View
style={{
width: '100%',
height: 400,
borderRadius: 20,
backgroundColor: 'red',
}}
/>
<View
style={{
width: '100%',
height: 400,
borderRadius: 20,
backgroundColor: 'red',
}}
/>
</ScrollView>
Run Code Online (Sandbox Code Playgroud)
小智 7
只需用View包装Scrollview并设置,就像下面的代码一样构建您的视图。它将迫使所有子视图溢出。overflow: 'hidden'
hidden
<View
style={{
borderRadius: 45l
overflow: 'hidden',
}}
>
// ->> Put your scrollview in here
<Scrollview>
{...children}
</Scrollview>
</View>
Run Code Online (Sandbox Code Playgroud)
归档时间: |
|
查看次数: |
926 次 |
最近记录: |