Android Tab Layout not taking up full width with custom view

前端 未结 8 2426
谎友^
谎友^ 2021-02-15 17:03

Android TabLayout tabPaddingTop and tabPaddingBottom not being removed

Please refer to the above issue as well.

Even since i updated my design library to \"23.2.

8条回答
  •  旧巷少年郎
    2021-02-15 17:48

    Instead of dealing with TabLayout subviews, you can access TabLayout.Tab view directly and set the padding to 0 just like the code below.

    for (int i = 0; i < tabLayout.getTabCount(); i++) {
        View tabView = tabLayout.getTabAt(i).view;
        tabView.setPadding(0, 0, 0, 0);
    }
    

    I'm doing this in the onCreateView callback and it works perfectly.

提交回复
热议问题