本文整理汇总了Java中android.widget.TabWidget.getChildCount方法的典型用法代码示例。如果您正苦于以下问题:Java TabWidget.getChildCount方法的具体用法?Java TabWidget.getChildCount怎么用?Java TabWidget.getChildCount使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类android.widget.TabWidget
的用法示例。
在下文中一共展示了TabWidget.getChildCount方法的9个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的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() {
List<TabModel> tabs = tabsToAdd();
fragmentManager = getSupportFragmentManager();
tabHost.setup(this, fragmentManager, android.R.id.tabcontent);
for (int i = 0; i < tabs.size(); i ++){
TabModel tab = tabs.get(i);
tabHost.addTab(
tabHost.newTabSpec(tab.getTag()).setIndicator(tab.getName(), null),
tab.getFragmentClass(),
tab.getFragmentArgs());
}
TabWidget widget = tabHost.getTabWidget();
for (int i = 0; i < widget.getChildCount(); i++) {
final TextView tv = (TextView) widget.getChildAt(i).findViewById(
android.R.id.title);
tv.setTextColor(this.getResources().getColorStateList(
R.color.tab_selector));
tv.setSingleLine(true);
tv.setAllCaps(true);
}
}
示例5: createTabs
import android.widget.TabWidget; //导入方法依赖的package包/类
private TabHost createTabs() {
TabHost tabHost = (TabHost) findViewById(android.R.id.tabhost);
if (tabHost == null)
return null;
tabHost.setup();
addTab(tabHost, "contact_query", R.string.label_keyword,
R.id.tabContactQuery);
addTab(tabHost, "ip_query", R.string.label_ip, R.id.tabIPQuery);
TabWidget tabWidget = tabHost.getTabWidget();
if (tabWidget == null)
return tabHost;
for (int i = 0; i < tabWidget.getChildCount(); i++) {
tabWidget.getChildAt(i).getLayoutParams().height = 60;
}
return tabHost;
}
示例6: setAppear
import android.widget.TabWidget; //导入方法依赖的package包/类
public void setAppear(int flag){
tabWidget = (TabWidget) findViewById(android.R.id.tabs);
tabWidget.setBackgroundResource(R.drawable.black_bg);
for (int i = 0; i < tabWidget.getChildCount(); i++) {
final TextView tv = (TextView) tabWidget.getChildAt(i)
.findViewById(android.R.id.title);
tabWidget.getChildAt(i).getLayoutParams().height = 60;
if (i == flag) {
tabWidget.getChildAt(i).setBackgroundResource(
R.drawable.tab_bankground);//设置背景
tv.setTextColor(Color.rgb(202, 151, 0));
} else {
tabWidget.getChildAt(i)
.setBackgroundResource(R.drawable.tab_bankground2);
tv.setTextColor(Color.WHITE);
tabWidget.getChildAt(i).setClickable(true);
}
tv.setTextSize(15);
}
}
示例7: 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);
}
}
示例8: setTabBackground
import android.widget.TabWidget; //导入方法依赖的package包/类
@Override
public void setTabBackground(TabWidget tabWidget) {
for (int i = 0; i < tabWidget.getChildCount(); i++) {
tabWidget.getChildAt(i).setBackgroundResource(R.drawable.tab_indicator_mytracks);
}
}
示例9: onCreate
import android.widget.TabWidget; //导入方法依赖的package包/类
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.demo_tab_view);
mTabWidget = ( TabWidget) findViewById(R.id.tabWidget1);
mTabWidget.setStripEnabled(false);
mTabWidget.setFocusable(false);
for (int i = 0; i < mTabWidget.getChildCount(); i++) {
mTabWidget.getChildAt(i).setOnClickListener(mTabClickListener);
mTabWidget.getChildAt(i).setOnFocusChangeListener(mTabFocusListener);
}
mViewPager = (ViewPager) findViewById(R.id.viewPager1);
mPagerAdapter = new MyPagerAdapter();
mViewPager.setAdapter(mPagerAdapter);
mViewPager.setOnPageChangeListener(mPageChangeListener);
mPagerAdapter.notifyDataSetChanged();
mTabWidget.focusCurrentTab(0);
BorderView borderView = new BorderView(this);
borderView.setBackgroundResource(R.drawable.border_highlight);
borderView.attachTo(mTabWidget);
BorderView borderView2 = new BorderView(this);
borderView2.setBackgroundResource(R.drawable.border_white_light_10);
borderView2.attachTo(mViewPager);
}