ViewPagerIndicator - 设置TabPageIndicator到中心中心、ViewPagerIndicator、TabPageIndicator

2023-09-05 06:12:13 作者:简单也极端

我做的 Android的,我用< A HREF =htt​​ps://github.com/JakeWharton/Android-ViewPagerIndicator> ViewPagerIndicator 的片段。但现在我有一个问题,我想获得TabPageIndicator到中心。喜欢这个:

I make an timetable application for and I'm using ViewPagerIndicator as fragment. But now I've a problem, I want to get the TabPageIndicator to the center. Like this:

,我也喜欢来设置各个选项卡的宽度和高度。并设置选项卡,以支持所选pssed / $ P $状态的绘制。

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.

我还没找到这些事,以解决这些问题。我已经尝试一些与 onPageSelected ContextThemeWrapper 但是,这并不正常工作。 (也许我不使用它正确)。

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).

这是一切可能使或者我应该比ViewPagerIndicator别的东西吗? (不ViewPagerIndicator的另一种选择是也欢迎)。

Is this all possible to make or should I look to something else than ViewPagerIndicator? (An other option without ViewPagerIndicator is also welcome).

在图像上的应用程序是条约资料移动,并且可以在PlayStore中找到。 我已经问他们是如何做到这一点的创造者,但他们表示,应用程序是不是开源。 (不过,我发现,他们这样做是有 TwoDScrollView 源,但我不敢肯定)

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)

编辑:

该造型是固定的 vpiTabPageIndicatorStyle 。 (随着XDA开发者的帮助!)

The styling is fixed with vpiTabPageIndicatorStyle. (With help of XDA Developers!)

当我加入20项它停留在中间,但只能从第4项至第17项,第1项,2,3,18,19,20不是在中间。参见:

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:

我可以添加3个空的项目(或空),以确保第一项和最后一项是在中间?这样的事情(从条约资料移动应用程序):

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):

(我已经尝试过安卓以下属性来 vpiTabPageIndicatorStyle 但是,这并不正常工作)

(I've already tried android:paddingLeft in vpiTabPageIndicatorStyle but that doesn't work)

我知道 viewPager.setCurrentItem(总/ 2)将设置在中间TabPageIndicator但它停留在中间,我不能够选择一天(我叫它 onPageScrolled )。所以我想为你滚动选择了一个需要在中间。这可能吗?

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?

推荐答案

你正在寻找的小部件类似于Android的水平轮。有一个实现在的Andr​​oid spinnerwheel 它可以是你所需要的。

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.

 
精彩推荐
图片推荐