0
这里是我的代码。我是新手可以有人请帮助我如何显示imageIcon中心就像测试出现在中心请让我知道如何自定义标签栏图像使用android。如何使用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);
}
}
最终标签栏图像应显示以及在中心标签栏的蓝线及以上。 图像应该显示为与屏幕上显示的标签栏文本相同 请帮助我如何制作自定义标签栏图像?
我不使用tabHOST我想通过动作条酒吧= getActionBar()做; Tab tab = bar.newTab(); tab.setText(headerName [i]); // tab.setIcon(R.drawable.info); – nida
它应该比使用tabhost更容易。你试过这个: http://developer.android.com/reference/android/app/ActionBar.Tab.html#setCustomView(int)? –