Android TabLayout固定模式但权重不同

Android TabLayout fixed mode but different weights

我有 4 个选项卡,其中一个的大小是其他选项卡的两倍,因此权重为:20% 40% 20% 20%

但是,当我使用 TabLayout(来自 android 设计支持库)将模式设置为 fixed 时,我不得不为所有对象设置相同的权重!这是应用宽度的源代码部分:

private void updateTabViewLayoutParams(LinearLayout.LayoutParams lp) {
    if (mMode == MODE_FIXED && mTabGravity == GRAVITY_FILL) {
        lp.width = 0;
        lp.weight = 1;
    } else {
        lp.width = LinearLayout.LayoutParams.WRAP_CONTENT;
        lp.weight = 0;
    }
}

但我需要不同的权重,以适合屏幕宽度。有什么方法可以应用我自己的权重吗?

    //SlidingTabStrip in TabLayout
    ViewGroup slidingTabStrip = (ViewGroup)mTablayout.getChildAt(0);
    //second tab in SlidingTabStrip
    View tab1 = slidingTabStrip.getChildAt(1);
    LinearLayout.LayoutParams layoutParams = (LinearLayout.LayoutParams) tab1.getLayoutParams();
    layoutParams.weight = 2;
    tab1.setLayoutParams(layoutParams);