List of usage examples for android.widget TextView setTypeface
public void setTypeface(@Nullable Typeface tf, @Typeface.Style int style)
From source file:cn.com.zzwfang.view.indicator.PagerSlidingTabStrip.java
private void updateTabStyles() { for (int i = 0; i < tabCount; i++) { View v = tabsContainer.getChildAt(i); v.setLayoutParams(defaultTabLayoutParams); v.setBackgroundResource(tabBackgroundResId); if (shouldExpand) { v.setPadding(0, 0, 0, 0);/*w w w . j a v a 2 s . com*/ } else { v.setPadding(tabPadding, 0, tabPadding, 0); } if (v instanceof TextView) { TextView tab = (TextView) v; tab.setTextSize(TypedValue.COMPLEX_UNIT_PX, tabTextSize); tab.setTypeface(tabTypeface, tabTypefaceStyle); if (pager.getCurrentItem() == i) { tab.setTextColor(tabTextColor); } else { tab.setTextColor(tabUnselectedTextColor); } // setAllCaps() is only available from API 14, so the upper case // is made manually if we are on a // pre-ICS-build if (textAllCaps) { tab.setText(tab.getText().toString().toUpperCase(locale)); } } } }
From source file:com.astuetz.PagerSlidingTitleIconTabStrip.java
private void updateTabStyles() { for (int i = 0; i < tabCount; i++) { View v = tabsContainer.getChildAt(i); v.setBackgroundResource(tabBackgroundResId); if (v instanceof LinearLayout) { if (((LinearLayout) v).getChildCount() > 1) { v = ((LinearLayout) v).getChildAt(1); } else { v = ((LinearLayout) v).getChildAt(0); }/*from w ww. j av a2s . c o m*/ } if (v instanceof TextView) { TextView tab = (TextView) v; tab.setTextSize(TypedValue.COMPLEX_UNIT_PX, tabTextSize); tab.setTypeface(tabTypeface, tabTypefaceStyle); if (i == currentPageSelected) { tab.setTextColor(tabTextColor); } // setAllCaps() is only available from API 14, so the upper case is made manually if we are on a // pre-ICS-build if (textAllCaps) { if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.ICE_CREAM_SANDWICH) { tab.setAllCaps(true); } else { tab.setText(tab.getText().toString().toUpperCase(locale)); } } } } }
From source file:cn.ieclipse.af.view.PagerSlidingTabStrip.java
private void updateTabStyles() { for (int i = 0; i < tabCount; i++) { View v = tabsContainer.getChildAt(i); // set tabs background if (tabBackgroundResId > 0) { v.setBackgroundResource(tabBackgroundResId); }//from w ww. j a v a 2 s .c om if (v instanceof TextView) { TextView tab = (TextView) v; tab.setTextSize(TypedValue.COMPLEX_UNIT_PX, tabTextSize); tab.setTypeface(tabTypeface, tabTypefaceStyle); tab.setTextColor(tabTextColor); // setAllCaps() is only available from API 14, so the upper case is made manually if we are on a // pre-ICS-build if (textAllCaps) { if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.ICE_CREAM_SANDWICH) { tab.setAllCaps(true); } else { tab.setText(tab.getText().toString().toUpperCase(locale)); } } } } setCurrentTabTextColor(selectedPosition); }
From source file:com.gx.appstore.lib.PagerSlidingTabStrip.java
private void updateTabStyles() { for (int i = 0; i < tabCount; i++) { View v = tabsContainer.getChildAt(i); v.setBackgroundResource(tabBackgroundResId); if (v instanceof TextView) { TextView tab = (TextView) v; tab.setTextSize(TypedValue.COMPLEX_UNIT_PX, tabTextSize); tab.setTypeface(tabTypeface, tabTypefaceStyle); tab.setTextColor(tabTextColor); // setAllCaps() is only available from API 14, so the upper case is made manually if we are on a // pre-ICS-build if (textAllCaps) { if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.ICE_CREAM_SANDWICH) { tab.setAllCaps(true); } else { tab.setText(tab.getText().toString().toUpperCase(locale)); }//from ww w . jav a 2 s .c o m } // if (i == mCurSelectedPos) { tab.setTextSize(TypedValue.COMPLEX_UNIT_PX, tabTextSizeSelected); tab.setTextColor(tabTextColorSelected); } } } }
From source file:com.haomee.view.PagerSlidingTabStrip.java
private void updateTabStyles() { for (int i = 0; i < tabCount; i++) { View v = tabsContainer.getChildAt(i); v.setBackgroundResource(tabBackgroundResId); if (v instanceof LinearLayout) { v = ((LinearLayout) v).getChildAt(0); }// ww w . j a va 2 s. c o m if (v instanceof TextView) { TextView tab = (TextView) v; tab.setTextSize(TypedValue.COMPLEX_UNIT_PX, tabTextSize); tab.setTypeface(tabTypeface, tabTypefaceStyle); tab.setTextColor(tabTextColor); // setAllCaps() is only available from API 14, so the upper case // is made manually if we are on a // pre-ICS-build if (textAllCaps) { if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.ICE_CREAM_SANDWICH) { tab.setAllCaps(true); } else { tab.setText(tab.getText().toString().toUpperCase(locale)); } } } if (v instanceof ImageButton) { ImageButton tab = (ImageButton) v; if (i == currentPosition) { tab.setImageResource(selected_images[i]); } else { tab.setImageResource(default_images[i]); } } } }
From source file:com.hcy.suzhoubusquery.utils.PagerSlidingTabStrip.java
private void updateTabStyles() { for (int i = 0; i < tabCount; i++) { View v = tabsContainer.getChildAt(i); v.setBackgroundResource(tabBackgroundResId); TextView tab = (TextView) v.findViewById(R.id.tv); if (tab != null) { tab.setTextSize(TypedValue.COMPLEX_UNIT_PX, tabTextSize); tab.setTypeface(tabTypeface, tabTypefaceStyle); tab.setTextColor(tabTextColor); // setAllCaps() is only available from API 14, so the upper case is made manually if we are on a // pre-ICS-build if (textAllCaps) { if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.ICE_CREAM_SANDWICH) { tab.setAllCaps(true); } else { tab.setText(tab.getText().toString().toUpperCase(locale)); }//from ww w .j a v a 2 s . c o m } } } }
From source file:com.cube.storm.ui.view.PagerSlidingTabStrip.java
private void updateTabStyles() { for (int i = 0; i < tabCount; i++) { android.view.View v = tabsContainer.getChildAt(i); v.setBackgroundResource(!tabSwitch ? tabBackgroundResId : transparentColorId); if (v instanceof TextView) { TextView tab = (TextView) v; tab.setTextSize(TypedValue.COMPLEX_UNIT_PX, tabTextSize); tab.setTypeface(tabTypeface, tabTypefaceStyle); tab.setTextColor(tabSwitch && i != 0 ? tabDeactivateTextColor : tabTextColor); // setAllCaps() is only available from API 14, so the upper case is made manually if we are on a // pre-ICS-build if (textAllCaps) { if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.ICE_CREAM_SANDWICH) { tab.setAllCaps(true); } else { tab.setText(tab.getText().toString().toUpperCase(locale)); }/*from www.j ava2 s. c o m*/ } } else if (v instanceof ImageButton) { ImageButton tab = (ImageButton) v; tab.setSelected(tabSwitch && i == 0 ? true : false); } } }
From source file:com.ekuater.labelchat.ui.widget.PagerSlidingTabStrip.java
private void setTabSelected(int position) { for (int i = 0; i < tabCount; i++) { final TextView tab = (TextView) tabsContainer.getChildAt(i); final boolean isSelected = i == position; tab.setSelected(isSelected);//from w ww . ja v a 2 s .c o m tab.setTypeface(tabTypeface, isSelected ? tabSelectedTypefaceStyle : tabTypefaceStyle); } }
From source file:com.example.yh.myapplication.widget.PagerSlidingTabStrip.java
private void updateTabStyles() { for (int i = 0; i < tabCount; i++) { View v = tabsContainer.getChildAt(i); v.setBackgroundResource(tabBackgroundResId); if (v instanceof TextView) { TextView tab = (TextView) v; tab.setTextSize(TypedValue.COMPLEX_UNIT_PX, unSelectTextsize); tab.setTypeface(tabTypeface, tabTypefaceStyle); tab.setTextColor(tabTextColor); // tab.setBackgroundColor(color); // setAllCaps() is only available from API 14, so the upper case // is made manually if we are on a // pre-ICS-build if (textAllCaps) { if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.ICE_CREAM_SANDWICH) { tab.setAllCaps(true); } else { tab.setText(tab.getText().toString().toUpperCase(locale)); }//from w w w . j a va 2 s.co m } if (i == selectedPosition) { tab.setTextSize(TypedValue.COMPLEX_UNIT_PX, selectTextSize); tab.setTextColor(selectedTextColor); if (roundBorder) { // if (i == 0) { // tab.setBackgroundResource(R.drawable.shape_food_mgr_titile_tab_left); // } else if (i == tabCount - 1) { // tab.setBackgroundResource(R.drawable.shape_food_mgr_titile_tab_right); // } else { // tab.setBackgroundResource(R.drawable.shape_food_mgr_titile_tab_middle); // } } } } } }
From source file:com.fivetrue.workout.timer.view.PagerSlidingTabStrip.java
private void selectTabTextColor(int position) { BasePagerAdapter adapter = (BasePagerAdapter) pager.getAdapter(); for (int i = 0; i < tabsContainer.getChildCount(); i++) { PagerTabContent content = (PagerTabContent) adapter.getItem(i); if (content.isShowingIcon()) { ImageView tabImage = (ImageView) tabsContainer.getChildAt(i); if (i == position) { tabImage.setSelected(true); } else { tabImage.setSelected(false); }// ww w. j ava 2s. c o m } else { TextView tabText = (TextView) tabsContainer.getChildAt(i); if (i == position) { tabText.setTypeface(null, selectTabTypefaceStyle); tabText.setTextColor(selectTextColor); } else { tabText.setTypeface(null, tabTypefaceStyle); tabText.setTextColor(tabTextColor); } } } }