【发布时间】:2021-08-19 17:29:01
【问题描述】:
我在 HarmonyOS 中实现了一个受ArcPageIndicator 启发的自定义页面滑块指示器,并测试我想使用页面滑块自动滑动页面。如何在 HarmonyOS 中做到这一点?
【问题讨论】:
标签: java android huawei-mobile-services huawei-developers harmonyos
我在 HarmonyOS 中实现了一个受ArcPageIndicator 启发的自定义页面滑块指示器,并测试我想使用页面滑块自动滑动页面。如何在 HarmonyOS 中做到这一点?
【问题讨论】:
标签: java android huawei-mobile-services huawei-developers harmonyos
在layout目录下的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。
【讨论】: