Android Tab Layout not taking up full width with custom view

前端 未结 8 2425
谎友^
谎友^ 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:44

    Just pass your tabLayout to this method and it's done!

    private void setTabLayoutMatchParent(TabLayout tabLayout) {
        final ViewGroup tabLayoutChild = (ViewGroup)(tabLayout.getChildAt(0));
        int tabLen = tabLayoutChild.getChildCount();
    
        for (int j = 0; j < tabLen; j++) {
            View v = tabLayoutChild.getChildAt(j);
            v.setPadding(0, 0, 0, 0);
        }
    }
    

提交回复
热议问题