当前位置: 首页>>代码示例>>Java>>正文


Java TabWidget.getChildAt方法代码示例

本文整理汇总了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);
		}
	}
}
 
开发者ID:z9961,项目名称:DoList,代码行数:21,代码来源:MainActivity.java

示例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]);
	}
   }
 
开发者ID:vassela,项目名称:AC2RD,代码行数:20,代码来源:ThemeManager.java

示例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);
    }
}
 
开发者ID:DanDits,项目名称:WhatsThat,代码行数:21,代码来源:UiStyleUtil.java

示例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);
    }
}
 
开发者ID:davidcampelo,项目名称:PublicOpenSpaceToolApp,代码行数:30,代码来源:PublicOpenSpaceAddEditFragment.java

示例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);
}
 
开发者ID:sages-health,项目名称:sagesmobile-mCollect,代码行数:35,代码来源:FileManagerTabs.java

示例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);
	}
}
 
开发者ID:Last-Mile-Health,项目名称:ODK-Liberia,代码行数:42,代码来源:FileManagerTabs.java

示例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);
    }
}
 
开发者ID:Last-Mile-Health,项目名称:ODK-Liberia,代码行数:45,代码来源:InstanceChooserTabs.java


注:本文中的android.widget.TabWidget.getChildAt方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。