Android Support Design TabLayout: Gravity Center and Mode Scrollable

前端 未结 13 2018

I am trying to use the new Design TabLayout in my project. I want the layout to adapt to every screen size and orientation, but it can be seen correctly in one orientation.<

13条回答
  •  隐瞒了意图╮
    2020-12-02 07:18

    I solved this using following

    if(tabLayout_chemistCategory.getTabCount()<4)
        {
            tabLayout_chemistCategory.setTabGravity(TabLayout.GRAVITY_FILL);
        }else
        {
            tabLayout_chemistCategory.setTabMode(TabLayout.MODE_SCROLLABLE);
    
        }
    

提交回复
热议问题