27 import android.widget.ImageView; |
27 import android.widget.ImageView; |
28 import android.widget.TabHost; |
28 import android.widget.TabHost; |
29 import android.widget.TextView; |
29 import android.widget.TextView; |
30 |
30 |
31 public final class UiUtils { |
31 public final class UiUtils { |
32 private UiUtils() { |
32 private UiUtils() { |
33 throw new AssertionError("This class is not meant to be instantiated"); |
33 throw new AssertionError("This class is not meant to be instantiated"); |
34 } |
34 } |
35 |
35 |
36 public static View createVerticalTabIndicator(TabHost tabHost, int label, int icon) { |
36 public static View createVerticalTabIndicator(TabHost tabHost, int label, int icon) { |
37 LayoutInflater inflater = (LayoutInflater) tabHost.getContext() |
37 LayoutInflater inflater = (LayoutInflater) tabHost.getContext() |
38 .getSystemService(Context.LAYOUT_INFLATER_SERVICE); |
38 .getSystemService(Context.LAYOUT_INFLATER_SERVICE); |
39 |
39 |
40 View view = inflater.inflate(R.layout.tab_indicator_vertical, |
40 View view = inflater.inflate(R.layout.tab_indicator_vertical, |
41 tabHost.getTabWidget(), false); |
41 tabHost.getTabWidget(), false); |
42 |
42 |
43 final TextView tv = (TextView) view.findViewById(R.id.title); |
43 final TextView tv = (TextView) view.findViewById(R.id.title); |
44 tv.setText(label); |
44 tv.setText(label); |
45 |
45 |
46 if (icon != 0) { |
46 if (icon != 0) { |
47 ImageView iconView = (ImageView) view.findViewById(R.id.icon); |
47 ImageView iconView = (ImageView) view.findViewById(R.id.icon); |
48 iconView.setImageResource(icon); |
48 iconView.setImageResource(icon); |
49 } |
49 } |
50 |
50 |
51 return view; |
51 return view; |
52 } |
52 } |
53 } |
53 } |