Search code examples
androidtitleandroid-tabhostuppercase

tab host title text appears in upper case want in lowercase


I have used this library and its title text shows in upper case I have referred

but not getting the correct output.

 <style name="AppTheme" parent="@style/Theme.AppCompat.Light">
    <!-- Customize your theme here. -->
    <item name="colorPrimary">@color/primary</item>
    <item name="colorPrimaryDark">@color/primary_dark</item>
    <item name="colorAccent">@color/accent</item>
    <item name="android:textColorPrimary">@color/text_color</item>
    <item name="drawerArrowStyle">@style/DrawerArrowStyle</item>
    <item name="android:actionBarTabTextStyle">@style/tab</item>
    <item name="actionBarTabTextStyle">@style/tab</item>

    <item name="android:windowBackground">@color/window_background</item>
    <item name="colorControlNormal">@color/accent</item>
    <item name="colorControlActivated">@color/secondary_text</item>
    <item name="colorControlHighlight">@color/secondary_text</item>
    <item name="android:homeAsUpIndicator">@drawable/ic_menu</item>

</style>

and

<style name="tab" parent="@style/Widget.AppCompat.Light.ActionBar.TabText">
    <item name="android:textAllCaps">false</item>
</style>

fragment.java:

    tabHost = (MaterialTabHost) v.findViewById(R.id.tabHost);
    adapter = new TabsPagerAdapter(getChildFragmentManager(), entity);
    pager = (ViewPager) v.findViewById(R.id.pager_entitiy_detail);
    pager.setOffscreenPageLimit(adapter.getCount());
    pager.setAdapter(adapter);
    adapter.notifyDataSetChanged();
    pager.setOnPageChangeListener(new ViewPager.SimpleOnPageChangeListener() {
        @Override
        public void onPageSelected(int position) {
            tabHost.setSelectedNavigationItem(position);
            Log.e("DashDetail", "");
        }
    });

    // insert all tabs from pagerAdapter data
    for (int i = 0; i < adapter.getCount(); i++) {
        tabHost.addTab(
                tabHost.newTab()
                        .setText(adapter.getPageTitle(i))
                        .setTabListener(this)
        );

    }

used above code for tab host and in adapter setting text but not getting lower case text.


Solution

  • thank you ,i have done what suggest in answer as shown above but still not worked so i have made changes in library by go through it code and analyse it. and i found that there is mentioned .toUpperCase() and i remove from there and it works.