【发布时间】:2013-11-22 09:23:43
【问题描述】:
这是我的代码。我是新手,有人可以帮助我如何在中心显示 imageIcon,就像测试出现在中心一样,请告诉我如何使用 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);
}
}
最终的标签栏图像应显示在标签栏的蓝线上方以及中心。 图像应与屏幕中出现的标签栏文本相同 请帮助我如何制作自定义标签栏图像?
【问题讨论】: