here is my code .I am newbie can someone please help me how can i display imageIcon in center just like test appear in center please let me know how can i customize tab bar image using android.
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
ActionBar bar = getActionBar();
bar.setNavigationMode(ActionBar.NAVIGATION_MODE_TABS);
bar.setDisplayOptions(ActionBar.DISPLAY_SHOW_CUSTOM | ActionBar.DISPLAY_USE_LOGO);
String headerName[] = {"Info","Location","Discipline","Summary","Status", "Plus"};
//int headerName[]={R.drawable.info,R.drawable.location,R.drawable.discipline,R.drawable.summary,R.drawable.status, R.drawable.plus};
Log.i("log ", "1");
for (int i=0; i < headerName.length; i++) {
Tab tab = bar.newTab();
// tab.setText(headerName[i]);
tab.setIcon(R.drawable.info);
tab.setTabListener(this);
bar.addTab(tab);
Log.i("log ", "" +i);
}
}
the final tab bar image should display above the Blue line of tab bar and as well as in center. the image should appear same as tab bar text appearing in screen please help me how can i make custom tab bar image?
Check out this post:
How to customize android tabs or background change?
You can simply use xml layout as tab content.
EDIT:
When You use ActionBar.Tab check out this ones:
http://developer.android.com/reference/android/app/ActionBar.Tab.html#setCustomView(int) http://www.lucazanini.eu/2012/android/customizing-the-labels-of-an-actionbar/
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.