How to Create Custom Tab In Android Application
thanks advance..
when i create custom tab in android application so no one tab display in main screen
开发者_运维知识库how to solve this problem please any one tell me?
you mean that you want to create custom tab for your application.ok now you have two class that is homemyclass.java and myclass.java. At first you declare flowing two line in homemyclass.java
private Intent mytab;
private static final String TAB_MYCLASS = "myclass";
then you write flowing line into onCreate() function of homemyclass.java
mytab = new Intent(this, myclass.class);
addTab(TAB_MYCLASS, getString(R.string."label for tab"), R.drawable."icon for tab display when
tab is selected", R.drawable."icon for tab display when tab is not selected", mytab);
just add addTab() into homemyclass.java
private void addTab(String tag, String label, int icon, int ficon, Intent content) {
TabHost tabHost = getTabHost();
TabSpec tabspecDialer = tabHost.newTabSpec(tag).setContent(content);
//boolean fails = true;
tabspecDialer.setIndicator(label, getResources().getDrawable(icon));
tabHost.addTab(tabspecDialer);
}
you also need to modify androidManifest.xml by homemyclass.java and myclass.java
精彩评论