How To Change Content Of A Tab While Switching
I am following one book tutorial. While developing it, I come across a typical problem. I need to know that how should I change my content of a Tab while I move from one tab to ano
Solution 1:
Here is a nice tutorial of TabActivity you are looking for,
For changing the icon of selected tab you have to create an xml for each tab like this in drawable folder
first_tab.xml
<itemandroid:state_selected="false"android:drawable="@drawable/tab_unselected_icon"/><itemandroid:state_selected="true"android:drawable="@drawable/tab_selected_icon"/></selector>
And the while creating tabs you have to use this xml like this,
intent = newIntent().setClass(this, Activity_name.class);
spec = tabHost.newTabSpec("yourTab_name").setIndicator("yourTab_name",res.getDrawable(R.drawable. first_tab)).setContent(intent);
tabHost.addTab(spec);
And you are done with it. Thanks.
Post a Comment for "How To Change Content Of A Tab While Switching"