我在HarmonyOS中实现了一个受ArcPageIndicator启发的自定义页面滑块指示器,并测试了我想要使用页面滑块自动滑动页面。我如何在HarmonyOS中做到这一点?
发布于 2021-07-28 17:52:09
在布局目录下的XML文件中创建一个ScrollView组件。ScrollView需要布局的支持。下面以DirectionalLayout为例。
<ScrollView
ohos:id="$+id:scrollview"
ohos:height="300vp"
ohos:width="300vp"
ohos:background_element="#FFDEAD"
ohos:top_margin="32vp"
ohos:bottom_padding="16vp"
ohos:layout_alignment="horizontal_center">
<DirectionalLayout
ohos:height="match_content"
ohos:width="match_content">
<!-- $media:plant: image resource referenced in the media directory-->
<Image
ohos:width="300vp"
ohos:height="match_content"
ohos:top_margin="16vp"
ohos:image_src="$media:plant"/>
<!-- Add content to be displayed -->
...
</DirectionalLayout>
</ScrollView>有关详细信息,请参阅scrollView of the Java UI。
https://stackoverflow.com/questions/68554653
复制相似问题