Android Tab Layout not taking up full width with custom view

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

    Setting different values or layout params did not work, so the only solution I got was to add the following, after you add the tabs to your tab layout,

    final ViewGroup test = (ViewGroup)(tabs.getChildAt(0));//tabs is your Tablayout
    int tabLen = test.getChildCount();
    
    for (int i = 0; i < tabLen; i++) {
                View v = test.getChildAt(i);
                v.setPadding(0, 0, 0, 0);
            }
    

提交回复
热议问题