【问题标题】:Center active tab inside TabLayout在 TabLayout 中居中活动选项卡
【发布时间】:2015-12-26 05:52:28
【问题描述】:

我正在使用来自设计支持库的 Google 新的 TabLayout,我想知道如何在该布局中居中活动选项卡。

目前我正像这样将整个布局居中:

<android.support.design.widget.TabLayout
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:layout_gravity="center_horizontal" />

现在我想在该布局内居中活动选项卡。类似于 TabLayout 之前的操作方式。无论有多少标签,活跃的标签总是在中心。我怎样才能做到这一点?谢谢。

【问题讨论】:

  • 好吧,你可以继续使用PagerTabStrip...

标签: android material-design android-tablayout


【解决方案1】:

SlidingTabStrip 需要使用 padding

看这里:https://stackoverflow.com/a/36886331/651770

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 2016-11-11
    • 1970-01-01
    • 2015-08-28
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多