zhpanvip / viewpagerindicator

🔥 Worked with ViewPager and ViewPager2,support multiple slider styles and multiple slide mode.This repo was split from BannerViewPager-
https://github.com/zhpanvip/BannerViewPager
Apache License 2.0
708 stars 58 forks source link

IndicatorSlideMode and IndicatorStyle not working as expected for "Normal" and "Round_Rect" #34

Open orbitalsonic opened 2 months ago

orbitalsonic commented 2 months ago

Problem:

I'm attempting to configure the indicator slide mode and style for a ViewPager using the following code:

XML app:vpi_slide_mode="scale" app:vpi_style="round_rect" setSlideMode(IndicatorSlideMode.SMOOTH) setIndicatorStyle(IndicatorStyle.ROUND_RECT)

Kotlin app:vpi_slide_mode="normal" app:vpi_style="round_rect" setSlideMode(IndicatorSlideMode.NORMAL) setIndicatorStyle(IndicatorStyle.ROUND_RECT)

My goal is to have the selected item displayed as a rectangle and the non-selected items as circles. However, when using IndicatorSlideMode.NORMAL and IndicatorStyle.ROUND_RECT, the desired behavior is not achieved.

Expected Behavior:

Selected item: Rectangle shape Non-selected items: Circle shape

Actual Behavior:

The actual behavior differs from the expected behavior when using IndicatorSlideMode.NORMAL and IndicatorStyle.ROUND_RECT.

I kindly request your assistance in resolving this issue. Please provide any guidance, suggestions, or workarounds that might help me achieve the desired indicator behavior.

zhpanvip commented 2 months ago

Use scale mode,you need call setSliderWidth(normalWidth,selectedWidth).