Question

Is it possible to change the textsize of a textview in a tabwidget when it's selected ?

Was it helpful?

Solution

Yes its possible, this is an example:

public class MainActivity extends TabActivity {

static TabHost mytabs;


mytabs = getTabHost();

    mytabs.setOnTabChangedListener(new OnTabChangeListener() {
        @Override
        public void onTabChanged(String arg0) {         
            Log.i("TAG", "Im currently in tab with index: " + mytabs.getCurrentTab());
            TabWidget tw = (TabWidget)tabHost.findViewById(android.R.id.tabs);
            View tabView = tw.getChildTabViewAt(mytabs.getCurrentTab());
            TextView tv = (TextView)tabView.findViewById(android.R.id.title);
            // Changing textSize.
            tv.setTextSize(20);
        }       
    });  
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top