运行时版本为5.0.0的Android上的NativeScript ScrollView错误



ScrollView isUserInteractionEnabled参数在NativeScript运行时版本5.0.0上的行为与在Android 4.2.0上的行为不同。

不需要脚本文件。您所需要的只是这个XML来观察这个问题:

<Page class="page" xmlns="http://www.nativescript.org/tns.xsd">
<ActionBar title="Horizontal Scroll Bug" class="action-bar">
</ActionBar>
<StackLayout>
<Label text="ScrollView's isUserInteractionEnabled property is false."
padding="10" textWrap="true" fontSize="20" />
<ScrollView id="horizontalScroll" orientation="horizontal" isUserInteractionEnabled="false">
<StackLayout orientation="horizontal">
<StackLayout backgroundColor="yellow">
<Label text="Box 1" padding="70" />
</StackLayout>
<StackLayout backgroundColor="red">
<Label text="Box 2" padding="70" />
</StackLayout>
<StackLayout backgroundColor="blue">
<Label text="Box 3" padding="70" />
</StackLayout>
<StackLayout backgroundColor="green">
<Label text="Box 4" padding="70" />
</StackLayout>
<StackLayout backgroundColor="purple">
<Label text="Box 5" padding="70" />
</StackLayout>
<StackLayout backgroundColor="orange">
<Label text="Box 6" padding="70" />
</StackLayout>
</StackLayout>
</ScrollView>
<Label text="Try to scroll the colored boxes above to the right and left to reveal more boxes.  You shouldn't be able to."
padding="10" textWrap="true" fontSize="20" />
<Label text="On Android with run time version 4.2.0 you can't, but on run time version 5.0.0 you can."
padding="10" textWrap="true" fontSize="20" />
</StackLayout>
</Page>

如果你想扫描二维码,我在NativeScript操场上发布了这个应用程序:https://play.nativescript.org/?template=play-js&id=hKrNlK

isUserInteractionEnabled设置为false时禁用滚动-这似乎是{N}5.x中引入的行为变化。同时,我不确定这是否是故意的,您可能想在Github上报告这一情况。

同时,您可以使用此变通方法。

最新更新