DEV Community

HarmonyOS
HarmonyOS

Posted on

How to hide the indicator in the Swiper component

Read the original article:How to hide the indicator in the Swiper component

Question

How to hide the indicator of Swiper component?

Solution/Short Answer

The Swiper component is a slider view container that provides the ability for subcomponents to display a sliding carousel. The built-in indicator can be turned off by setting the indicator property to false.

@Entry
@Component
export struct  SwiperIndicator{
  build() {
    Column(){
      Swiper(){
        Image($r('app.media.background'))
          .width(20)
          .height(20)
        Image($r('app.media.background'))
          .width(20)
          .height(20)
        Image($r('app.media.background'))
          .width(20)
          .height(20)
      }
      .width('100%')
      .height('60%')
// hide indicator
      .indicator(false)
    }
    .alignSelf(ItemAlign.Center)
    .alignItems(HorizontalAlign.Center)
  }
}
Enter fullscreen mode Exit fullscreen mode

Related Community Issues

https://developer.huawei.com/consumer/cn/forum/topic/0201169118575120030

Written by Simay Ayberik

Top comments (0)