本文整理汇总了Java中android.widget.TabWidget.getChildAt方法的典型用法代码示例。如果您正苦于以下问题:Java TabWidget.getChildAt方法的具体用法?Java TabWidget.getChildAt怎么用?Java TabWidget.getChildAt使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类android.widget.TabWidget
的用法示例。
在下文中一共展示了TabWidget.getChildAt方法的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: changeTabBackGround
import android.widget.TabWidget; //导入方法依赖的package包/类
private void changeTabBackGround() { // 改变选项卡的颜色
// 得到当前选中选项卡的索引
int index = getTabHost().getCurrentTab();
// 调用tabhost中的getTabWidget()方法得到TabWidget
TabWidget tabWidget = getTabHost().getTabWidget();
// 得到选项卡的数量
int count = tabWidget.getChildCount();
// 循环判断,只有点中的索引值改变背景颜色,其他的则恢复未选中的颜色
for (int i = 0; i < count; i++) {
View view = tabWidget.getChildAt(i);
TextView tv = (TextView) tabWidget.getChildAt(i).findViewById(
android.R.id.title);
tv.setTextSize(20);
if (index == i) {
view.setBackgroundResource(color.holo_blue_dark);
} else {
view.setBackgroundResource(color.holo_blue_light);
}
}
}
示例2: setTabWidget
import android.widget.TabWidget; //导入方法依赖的package包/类
public void setTabWidget(Context context, TabWidget tabwidget)
{
SharedPreferences sharedPreferences = PreferenceManager.getDefaultSharedPreferences(context);
int themeSet = Integer.parseInt(sharedPreferences.getString("preferences_theme_set", "0"));
int colorThemeSet = Integer.parseInt(sharedPreferences.getString("preferences_color_theme_set", "7"));
for(int i = 0; i < tabwidget.getChildCount(); i++)
{
View v = tabwidget.getChildAt(i);
TextView textview = (TextView)v.findViewById(android.R.id.title);
if(textview == null)
{
continue;
}
v.setBackgroundResource(tabwidget_drawable[themeSet][colorThemeSet]);
}
}
示例3: setTabHostSelector
import android.widget.TabWidget; //导入方法依赖的package包/类
public static void setTabHostSelector(TabHost host, int selector) {
if (host == null) {
return;
}
TabWidget widget = host.getTabWidget();
if (widget == null) {
return;
}
for(int i = 0; i < widget.getChildCount(); i++) {
View v = widget.getChildAt(i);
if (v == null) {
continue;
}
TextView tv = (TextView) v.findViewById(android.R.id.title);
if (tv == null) {
continue;
}
v.setBackgroundResource(selector);
}
}
示例4: setupTabs
import android.widget.TabWidget; //导入方法依赖的package包/类
private void setupTabs(TabHost host) {
host.setup();
TabHost.TabSpec spec;
// Set up titles
int[] tabContents = new int[]{R.id.addEditItemTab0, R.id.addEditItemTab1, R.id.addEditItemTab2, R.id.addEditItemTab3, R.id.addEditItemTab4, R.id.addEditItemTab5};
for (int i = -1; ++i < Constants.TAB_TITLES.length; ) {
//Tabs
spec = host.newTabSpec(Constants.TAB_TITLES[i]);
spec.setContent(tabContents[i]);
spec.setIndicator(Constants.TAB_TITLES[i]);
host.addTab(spec);
((TextView) host.getTabWidget().getChildAt(i).findViewById(android.R.id.title)).setAllCaps(false);
}
// Apply the right style
TabWidget widget = host.getTabWidget();
for(int i = 0; i < widget.getChildCount(); i++) {
View v = widget.getChildAt(i);
// Look for the title view to ensure this is an indicator and not a divider.
TextView tv = (TextView)v.findViewById(android.R.id.title);
if(tv == null) {
continue;
}
v.setBackgroundResource(R.drawable.tab_indicator_ab_green);
}
}
示例5: onCreate
import android.widget.TabWidget; //导入方法依赖的package包/类
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setTitle(getString(R.string.app_name) + " > " + getString(R.string.manage_files));
final TabHost tabHost = getTabHost();
tabHost.setBackgroundColor(Color.WHITE);
tabHost.getTabWidget().setBackgroundColor(Color.BLACK);
Intent remote = new Intent(this, DataManagerList.class);
tabHost.addTab(tabHost.newTabSpec(DATA_TAB).setIndicator(getString(R.string.data))
.setContent(remote));
Intent local = new Intent(this, FormManagerList.class);
tabHost.addTab(tabHost.newTabSpec(FORMS_TAB).setIndicator(getString(R.string.forms))
.setContent(local));
// hack to set font size
LinearLayout ll = (LinearLayout) tabHost.getChildAt(0);
TabWidget tw = (TabWidget) ll.getChildAt(0);
int fontsize = Collect.getQuestionFontsize();
RelativeLayout rllf = (RelativeLayout) tw.getChildAt(0);
mTVFF = (TextView) rllf.getChildAt(1);
mTVFF.setTextSize(fontsize);
mTVFF.setPadding(0, 0, 0, 6);
RelativeLayout rlrf = (RelativeLayout) tw.getChildAt(1);
mTVDF = (TextView) rlrf.getChildAt(1);
mTVDF.setTextSize(fontsize);
mTVDF.setPadding(0, 0, 0, 6);
}
示例6: onCreate
import android.widget.TabWidget; //导入方法依赖的package包/类
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setTitle(getString(R.string.app_name) + " > "
+ getString(R.string.manage_files));
final TabHost tabHost = getTabHost();
tabHost.setBackgroundColor(Color.WHITE);
tabHost.getTabWidget().setBackgroundColor(Color.DKGRAY);
Intent remote = new Intent(this, DataManagerList.class);
tabHost.addTab(tabHost.newTabSpec(DATA_TAB)
.setIndicator(getString(R.string.data)).setContent(remote));
Intent local = new Intent(this, FormManagerList.class);
tabHost.addTab(tabHost.newTabSpec(FORMS_TAB)
.setIndicator(getString(R.string.forms)).setContent(local));
// hack to set font size
LinearLayout ll = (LinearLayout) tabHost.getChildAt(0);
TabWidget tw = (TabWidget) ll.getChildAt(0);
int fontsize = Collect.getQuestionFontsize();
ViewGroup rllf = (ViewGroup) tw.getChildAt(0);
mTVFF = getTextViewChild(rllf);
if (mTVFF != null) {
mTVFF.setTextSize(fontsize);
mTVFF.setTextColor(Color.WHITE);
mTVFF.setPadding(0, 0, 0, 6);
}
ViewGroup rlrf = (ViewGroup) tw.getChildAt(1);
mTVDF = getTextViewChild(rlrf);
if (mTVDF != null) {
mTVDF.setTextSize(fontsize);
mTVDF.setTextColor(Color.WHITE);
mTVDF.setPadding(0, 0, 0, 6);
}
}
示例7: onCreate
import android.widget.TabWidget; //导入方法依赖的package包/类
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setTitle(getString(R.string.app_name) + " > " + getString(R.string.review_data));
// create tab host and tweak color
final TabHost tabHost = getTabHost();
tabHost.setBackgroundColor(Color.WHITE);
tabHost.getTabWidget().setBackgroundColor(Color.BLACK);
// create intent for saved tab
Intent saved = new Intent(this, InstanceChooserList.class);
tabHost.addTab(tabHost.newTabSpec(SAVED_TAB)
.setIndicator(getString(R.string.saved_data, mSavedCount)).setContent(saved));
// create intent for completed tab
Intent completed = new Intent(this, InstanceChooserList.class);
tabHost.addTab(tabHost.newTabSpec(COMPLETED_TAB)
.setIndicator(getString(R.string.completed_data, mCompletedCount))
.setContent(completed));
// hack to set font size and padding in tab headers
// arrived at these paths by using hierarchy viewer
LinearLayout ll = (LinearLayout) tabHost.getChildAt(0);
TabWidget tw = (TabWidget) ll.getChildAt(0);
int fontsize = Collect.getQuestionFontsize();
RelativeLayout rls = (RelativeLayout) tw.getChildAt(0);
TextView tvs = (TextView) rls.getChildAt(1);
tvs.setTextSize(fontsize);
tvs.setPadding(0, 0, 0, 6);
RelativeLayout rlc = (RelativeLayout) tw.getChildAt(1);
TextView tvc = (TextView) rlc.getChildAt(1);
tvc.setTextSize(fontsize);
tvc.setPadding(0, 0, 0, 6);
if (mSavedCount >= mCompletedCount) {
getTabHost().setCurrentTabByTag(SAVED_TAB);
} else {
getTabHost().setCurrentTabByTag(COMPLETED_TAB);
}
}