HarmonyOS Swiper组件的Indicator设置bottom(0)没有贴底
private swiperController: SwiperController = new SwiperController()
@Builder
content() {
Column() {
Swiper(this.swiperController) {
Stack() {
Text("1")
.width('100%')
.height(155)
.backgroundColor('#a067c8ff')
.textAlign(TextAlign.Center)
.fontSize(30)
}
.alignContent(Alignment.TopStart)
.margin({ left: 4, right: 4 })
.height(172)
Stack() {
Text("2")
.width('100%')
.height(155)
.backgroundColor('#4067c8ff')
.textAlign(TextAlign.Center)
.fontSize(30)
}.alignContent(Alignment.TopStart)
.margin({ left: 4, right: 4 })
.height(172)
Stack() {
Text("3")
.width('100%')
.height(172)
.backgroundColor('#7067c8ff')
.textAlign(TextAlign.Center)
.fontSize(30)
}.alignContent(Alignment.TopStart)
.margin({ left: 4, right: 4 })
.height(172)
}
.loop(true)
.autoPlay(true)
.interval(5000)
.nextMargin(12)
.prevMargin(12)
.height(172)
.indicator(
Indicator.dot()
.bottom(0)
.itemWidth(10)
.itemHeight(2)
.selectedItemWidth(16)
.selectedItemHeight(2)
.color('#1E666666')
.selectedColor('#666666')
)
}
.width('100%').height(172).alignSelf(ItemAlign.Start)
}
如上代码,设置了Indicator.dot().bottom(0)想让指示器贴底,但是发现还有一段距离,不能实现紧贴底部。
HarmonyOS
赞
收藏 0
回答 1
待解决
相关问题
HarmonyOS Swiper使用时Indicator设置位置不生效
121浏览 • 1回复 待解决
组件实现未占满时自定义footer贴底显示
448浏览 • 1回复 待解决
Swiper的indicator后续会支持自定义吗
1577浏览 • 1回复 待解决
Swiper的indicator 在使用过程整,IDE提示错误
473浏览 • 1回复 待解决
Swiper组件如何设置导航点位置
1748浏览 • 1回复 待解决
Swiper组件设置不跟随手势滑动
159浏览 • 1回复 待解决
父组件高度为0时,如何设置溢出隐藏
582浏览 • 1回复 待解决
如何设置Swiper导航点的样式?
209浏览 • 1回复 待解决
布局的postion是否可以支持bottom,right能力
430浏览 • 0回复 待解决
Swiper是否支持组件复用
520浏览 • 1回复 待解决
HarmonyOS Swiper组件是否支持子组件为Video组件,并且可以自动播放
153浏览 • 1回复 待解决
使用swiper组件实现viewPager效果
833浏览 • 1回复 待解决
HarmonyOS swiper轮播指示器设置距离下边界距离问题
151浏览 • 1回复 待解决
如何设置swiper指示器不显示
664浏览 • 1回复 待解决
Swiper中子组件高度不同,导致切换时UI显示异常,如何保持Swiper中子组件在高度不同时,Swiper显示不异常?
138浏览 • 1回复 待解决
HarmonyOS 请问List组件的滑动阻尼能否调整至与Swiper效果相同?
125浏览 • 1回复 待解决
HarmonyOS Swiper组建使用
130浏览 • 1回复 待解决
将Button的borderRadius设置为0为什么圆角还存在?
241浏览 • 1回复 待解决
HarmonyOS 获取的oaid都是0
309浏览 • 1回复 待解决
Select组件的设置.optionWidth("50vp")没有生效
122浏览 • 1回复 待解决
HarmonyOS如何去除尾部多余的0 方法吗?
690浏览 • 1回复 待解决
HarmonyOS 使用ShareController组件进行分享 分享出去的文件是0B
102浏览 • 1回复 待解决
如何使用Swiper组件实现下拉刷新
418浏览 • 1回复 待解决
Swiper 组件嵌套图片刷新数据会闪烁
650浏览 • 1回复 待解决
Indicator 导航点的可见范围边界至实际范围边界存在一定距离,该距离会随着itemWidth、itemHeight、selectedItemWidth、selectedItemHeight等参数变大而变大,因此无法完全靠左。参考地址:
https://developer.huawei.com/consumer/cn/doc/harmonyos-references-V5/ts-container-swiper-V5
目前Indicator与swiper组件的边界有一定距离,bottom(0)不是贴在边界处的效果,以下是尝试解决方法:
1、将swiper分开,上方是内容区,下方是Indicator区域,可设置内容区的宽高调整Indicator区域的大小 ,您可以参考此demo:
https://gitee.com/harmonyos-cases/cases/blob/master/CommonAppDevelopment/feature/indicatorbelowswiper/README.md#/harmonyos-cases/cases/blob/master/CommonAppDevelopment/feature/indicatorbelowswiper/src/main/ets/view/IndicatorBelowSwiper.ets
2、通过自定义指示器,以下是demo: