画像を使用せずにAndroidでカスタマイズされたタブバーを作成するにはどうすればよいですか?このようなタブバーを作成する必要があります...

画像を使用せずにAndroidでカスタマイズされたタブバーを作成するにはどうすればよいですか?このようなタブバーを作成する必要があります...

私はstackoverflow自体で私の質問に対する答えを見つけました
次の質問でHardikGajjarが行った回答を参照してください。
ビューをタブに関連付けることができます。
tabHost.newTabSpec("name").setIndicator(R.id.your_view)
タブボタンごとにカスタムビューを作成する必要があり、カメラタブに対しては異なるビューを返します。私はこのようなものだと思います:
private void fillTabHost() {
setupTab(ONE, new Intent().setClass(this, Activity.class), "title",R.drawable.icon);
setupTab(TWO, new Intent().setClass(this, Activity.class), "title", R.drawable.icon);
setupTab(THREE, new Intent().setClass(this, Activity.class), "title",R.drawable.icon);
setupTab(FOUR, new Intent().setClass(this, Activity.class), "title",R.drawable.icon);
setupTab(FIVE, new Intent().setClass(this, Activity.class), "title",R.drawable.icon);
}
private void setupTab(final String tag, Intent intent, int label, int icon) {
View tabview = createTabView(tag, mContext, label, icon);
TabSpec setContent = mTabHost.newTabSpec(tag).setIndicator(tabview).setContent(intent);
mTabHost.addTab(setContent);
}
private static View createTabView(String tag, final Context context, final int text, final int icon) {
if(tag.equals("THREE")){
// TODO return your CAMERA view
}else{
View view = LayoutInflater.from(context).inflate(R.layout.tabs_bg, null);
ImageView iv = (ImageView) view.findViewById(R.id.tabsIcon);
iv.setBackgroundResource(icon);
TextView tv = (TextView) view.findViewById(R.id.tabsText);
tv.setText(text);
}
return view;
}
これがお役に立てば幸いです。