project_files/Android-build/SDL-android-project/src/org/hedgewars/hedgeroid/util/UiUtils.java
equal
deleted
inserted
replaced
|
1 package org.hedgewars.hedgeroid.util; |
|
2 |
|
3 import org.hedgewars.hedgeroid.R; |
|
4 |
|
5 import android.content.Context; |
|
6 import android.view.LayoutInflater; |
|
7 import android.view.View; |
|
8 import android.widget.ImageView; |
|
9 import android.widget.TabHost; |
|
10 import android.widget.TextView; |
|
11 |
|
12 public final class UiUtils { |
|
13 private UiUtils() { |
|
14 throw new AssertionError("This class is not meant to be instantiated"); |
|
15 } |
|
16 |
|
17 public static View createTabIndicator(TabHost tabHost, int label, int icon) { |
|
18 LayoutInflater inflater = (LayoutInflater) tabHost.getContext() |
|
19 .getSystemService(Context.LAYOUT_INFLATER_SERVICE); |
|
20 |
|
21 View view = inflater.inflate(R.layout.tab_indicator_vertical, |
|
22 tabHost.getTabWidget(), false); |
|
23 |
|
24 final TextView tv = (TextView) view.findViewById(R.id.title); |
|
25 tv.setText(label); |
|
26 |
|
27 if (icon != 0) { |
|
28 ImageView iconView = (ImageView) view.findViewById(R.id.icon); |
|
29 iconView.setImageResource(icon); |
|
30 } |
|
31 |
|
32 return view; |
|
33 } |
|
34 } |