Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- 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;
- }
Add Comment
Please, Sign In to add comment