How to align selected tab to center of tablayout?

时间:2018-02-01 18:24:25

标签: android android-tablayout

I am developing an android application. I need to use a tablayout on a section of the application. But I'm unable to align the selected tab to the center of the tablayout. Can anyone help me please ?

1 个答案:

答案 0 :(得分:0)

Gravity用于布置TabLayout中心的标签。

TabLayout_tabGravity = "GRAVITY_CENTER"

  tabLayout.setTabGravity(TabLayout.GRAVITY_CENTER);