android tabs allCaps works only for first tab

Viewed 22

I'm trying to set my tabs text textAllCaps to false.

For some reason only firs tab has needed results, but the second is still all caps.

https://imgur.com/a/fnv2DzY

I've set tabTextAppearance to MyCustomTextAppearance and in styles two attributes are set to textAllCaps, android:textAllCaps are set to false

activity:

<com.google.android.material.tabs.TabLayout
            android:id="@+id/tabLayout"
            android:layout_width="match_parent"
            android:layout_height="wrap_content"
            android:layout_below="@+id/appbar"
            app:tabTextAppearance="@style/MyCustomTextAppearance" />

in styles:

    <style name="MyCustomTabLayout" parent="Widget.Design.TabLayout">
        <item name="tabTextAppearance">@style/MyCustomTextAppearance</item>
    </style>

    <style name="MyCustomTextAppearance" parent="TextAppearance.Design.Tab">
        <item name="textAllCaps">false</item>
        <item name="android:textAllCaps">false</item>
    </style>

in Java:

public class NewLoginActivity extends BaseActivity implements
        RegisterFragment.OnFragmentInteractionListener,
        LoginFragment.OnFragmentInteractionListener {

    public ActivityNewLoginBinding binding;
    private List<String> titles;

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        binding = DataBindingUtil.setContentView(this, R.layout.activity_new_login);
        setSupportActionBar(binding.toolbar);

        setToolBarTitle(getSupportActionBar(), getResources().getString(R.string.login_action_title));
        if (getSupportActionBar() != null){
            getSupportActionBar().setHomeButtonEnabled(false);      // Disable the button
            getSupportActionBar().setDisplayHomeAsUpEnabled(false); // Remove the left caret
            getSupportActionBar().setDisplayShowHomeEnabled(false); // Remove the icon
        }

        binding.tabLayout.setTabGravity(TabLayout.GRAVITY_FILL);
        binding.tabLayout.setTabMode(TabLayout.MODE_FIXED);

        titles = new ArrayList<>();
        titles.add(getString(R.string.login_action_title));
        titles.add(getString(R.string.regi));
        Bundle bundle = getIntent().getExtras();

        LoginTabAdapter tabAdapter;
        tabAdapter = new LoginTabAdapter(getSupportFragmentManager(), this, titles);

        binding.viewPager.setAdapter(tabAdapter);
        binding.viewPager.setOffscreenPageLimit(1);
        binding.tabLayout.setupWithViewPager(binding.viewPager);

        if (bundle != null && bundle.containsKey("signup")) {
            binding.viewPager.setCurrentItem(2);
        }
    }
0 Answers
Related