Android的 - 谷歌播放喜欢的标签标签、喜欢、Android

2023-09-13 23:38:42 作者:睫毛下的泪珠

谷歌刚刚实施了新的面貌他们的标签在谷歌播放。

Google has just implemented a new look to their tabs in Google Play.

我知道这可以ViewPagerIndicator做,但我不喜欢用我的应用程序的另一个库,并通过另一个MB撞击应用程序的大小左右。

I know this can be done with ViewPagerIndicator, yet I wouldn't like to use another library in my application and bump the app's size by another MB or so.

我目前使用的android.support.v4.view.PagerTabStrip(如在老谷歌播放),我想知道,如果新的外观也可以使用Android的支持库来实现。

I am currently using the android.support.v4.view.PagerTabStrip (like in the old Google Play), and I'm wondering if the new look can also be implemented using the android support library.

在此先感谢。

推荐答案

设计支持库包括 TabLayout 控件,它可以让你实现一个谷歌播放烈标签:

Design Support Library (current method).

The Design Support Library includes the TabLayout widget which allows you to implement a Google Play-lie tabs:

<android.support.design.widget.TabLayout
    android:id="@+id/tabs"
    android:layout_width="match_parent"
    android:layout_height="wrap_content" />

,然后初始化它:

and then initializing it:

TabLayout tabLayout = (TabLayout) findViewById(R.id.tabs);
tabLayout.setupWithViewPager(viewPager);

有关完整的示例,请参见 Cheesesquare应用

For a full example see the Cheesesquare app

这是一个随时可以使用的库,可以发现Github上。

This is a ready-to-use library that you can find on Github.