I make an timetable application for android and I'm using ViewPagerIndicator as fragment. But now I've a problem, I want to get the TabPageIndicator to the center. Like this:
And I would to like to set the individual tab width and height. And set that tab to a drawable that support selected/pressed states.
I've not found it yet to solve these problems. I've try something with onPageSelected
and ContextThemeWrapper
but that doesn't work. (Maybe I'm not using it correctly).
Is this all possible to make or should I look to something else than ViewPagerIndicator? (An other option without ViewPagerIndicator is also welcome).
The app on the image is Untis Mobile and can be found on the PlayStore. I've already ask the creators how they do it but they said the app isn't open source. (But I have found in the source that they do it with TwoDScrollView, but I'm not sure)
Edit:
The styling is fixed with vpiTabPageIndicatorStyle
. (With help of XDA Developers!)
When I add 20 items it stays on the middle but only from item 4 to item 17, item 1, 2, 3, 18, 19, 20 are not in the middle. See:
Can I add a 3 empty items (or empty space) to ensure that the first and last items are in the middle? Something like this (from the Untis Mobile app):
(I've already tried android:paddingLeft
in vpiTabPageIndicatorStyle
but that doesn't work)
I know that viewPager.setCurrentItem(total/2)
will set the TabPageIndicator in the middle but then it stays on the middle and I'm not able to select a other day (I call it in onPageScrolled
). So I want as you scroll the selected one needs to be in the middle. Is this possible?
The widget you are looking for is similar to the android horizontal wheel. There is an implementation at android-spinnerwheel which can be what you need.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With