Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Indicator dots below image #120

Open
fauziasf opened this issue Jun 15, 2020 · 3 comments
Open

Indicator dots below image #120

fauziasf opened this issue Jun 15, 2020 · 3 comments

Comments

@fauziasf
Copy link

can you help me put the indicator dots below the image slider?

@Frank1234
Copy link

some code to get you started...

In your own constraintlayout, also add the indicator:

<com.synnapps.carouselview.CarouselView
    android:id="@+id/image_carousel"
    app:layout_constraintEnd_toEndOf="parent"
    app:layout_constraintStart_toStartOf="parent"
    app:layout_constraintTop_toTopOf="parent" />

<com.synnapps.carouselview.CirclePageIndicator
    android:id="@+id/_image_carousel_indicator"
    android:layout_width="match_parent"
    android:layout_height="wrap_content"
    app:layout_constraintStart_toStartOf="parent"
    app:layout_constraintTop_toBottomOf="@+id/image_carousel" />`

then connect the two manually and disable the default indicator:

productsImageCarousel.setIndicatorVisibility(View.GONE) // we have our own indicator
productsImageCarouselIndicator.apply {

    setViewPager(imageCarousel.containerViewPager)

    isVisible = images.size > 1
    fillColor = resources.getColor(R.color.carouselIndicatorSelected, theme)
    ... etc.
}

@ytxmobile98
Copy link

ytxmobile98 commented Apr 26, 2021

some code to get you started...

In your own constraintlayout, also add the indicator:

<com.synnapps.carouselview.CarouselView
    android:id="@+id/image_carousel"
    app:layout_constraintEnd_toEndOf="parent"
    app:layout_constraintStart_toStartOf="parent"
    app:layout_constraintTop_toTopOf="parent" />

<com.synnapps.carouselview.CirclePageIndicator
    android:id="@+id/_image_carousel_indicator"
    android:layout_width="match_parent"
    android:layout_height="wrap_content"
    app:layout_constraintStart_toStartOf="parent"
    app:layout_constraintTop_toBottomOf="@+id/image_carousel" />`

then connect the two manually and disable the default indicator:

productsImageCarousel.setIndicatorVisibility(View.GONE) // we have our own indicator
productsImageCarouselIndicator.apply {

    setViewPager(imageCarousel.containerViewPager)

    isVisible = images.size > 1
    fillColor = resources.getColor(R.color.carouselIndicatorSelected, theme)
    ... etc.
}

I am trying to implement a carousel with dots under the image.

Tried to use your lines but getting this error: "error: containerViewPager has private access in CarouselView".

Please help!

@Frank1234
Copy link

It has a public getter, do you use kotlin? In com.synnapps.carouselview.CarouselView:

public CarouselViewPager getContainerViewPager() {
        return containerViewPager;
}

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants