List of usage examples for android.widget TextView setTypeface
public void setTypeface(@Nullable Typeface tf, @Typeface.Style int style)
From source file:com.anniu.shandiandaojia.view.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; //TODO tab? ???? tab.setTextSize(TypedValue.COMPLEX_UNIT_SP, tabTextSize); tab.setTypeface(tabTypeface, tabTypefaceStyle); tab.setTextColor(tabTextColor); if (i == currentPosition) { tab.setTextColor(tabTextColorSelected); } else { tab.setTextColor(tabTextColor); }//from w ww . j a v a 2 s. c om 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:com.cmax.bodysheild.widget.PagerSlidingTabStripExtends.java
/** * ?/*from w w w . ja v a2 s. com*/ */ 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)); } } // if (mSelectedPostion == i) { tab.setTextSize(TypedValue.COMPLEX_UNIT_PX, selectedTabTextSize); tab.setTextColor(selectedTabTextColor); } } } }
From source file:com.coolerfall.uiart.PagerSlidingTabStrip.java
/** update the style of number text */ private void updateNumTextStyle(TextView tab) { tab.setTextSize(TypedValue.COMPLEX_UNIT_PX, mNumTextSize); tab.setTypeface(mTabTypeface, mTabTypefaceStyle); tab.setTextColor(mNumTextColor);//from w w w. j av a 2s . co m if (Build.VERSION.SDK_INT < Build.VERSION_CODES.JELLY_BEAN) { setBackgroud(tab); } else { setBackgroundJelly(tab); } }
From source file:com.heqi.kharazim.ui.fragment.tab.PagerSlidingTabStrip.java
private void updateTabStyles() { for (int i = 0; i < tabCount; i++) { View v = tabsContainer.getChildAt(i); v.setLayoutParams(defaultTabLayoutParams); v.setBackgroundResource(tabBackgroundResId); 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 (tabTextColorStateList != null) { tab.setTextColor(tabTextColorStateList); } else { tab.setTextColor(tabTextColor); }//from w w w .j a v a2 s . co m // 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:com.chatwing.whitelabel.adapters.ConversationsAdapter.java
@Override public void bindView(View view, Context context, Cursor cursor) { Conversation conversation = ConversationTable.getConversation(cursor); TextView aliasTv = (TextView) view.findViewById(android.R.id.text1); aliasTv.setText(conversation.getConversationAlias(mCurrentUser.getId())); int countIndexColumn = cursor.getColumnIndex(ConversationTable.UNREAD_COUNT); int count = cursor.getInt(countIndexColumn); TextView countTv = (TextView) view.findViewById(R.id.unread_count); if (count == 0) { countTv.setVisibility(View.GONE); } else {/*from ww w . j a v a 2s . c o m*/ countTv.setText(String.valueOf(count)); countTv.setVisibility(View.VISIBLE); } LogUtils.v("Conversation " + aliasTv.getText() + ":" + conversation.isModerator()); if (conversation.isModerator()) { aliasTv.setTypeface(null, Typeface.ITALIC); } else { aliasTv.setTypeface(null, Typeface.NORMAL); } }
From source file:com.dashihui.afford.ui.widget.WdtPagerTabServerTime.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); /*****************/ // tab.setBackgroundResource(R.drawable.servicetime_btn_label_bottom); // 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 a v a 2 s. co m*/ } } } }
From source file:com.coolerfall.uiart.PagerSlidingTabStrip.java
/** update the style of title text */ private void updateTabTextStyle(TextView tab, int color) { tab.setTextSize(TypedValue.COMPLEX_UNIT_PX, mTabTextSize); tab.setTypeface(mTabTypeface, mTabTypefaceStyle); tab.setTextColor(color);// w w w . ja v a2 s . co m }
From source file:com.desports.golf.view.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 w w w . j a v a2 s .com*/ } if (i == selectedPosition) { tab.setTextColor(selectedTabTextColor); } } } }
From source file:cn.mailchat.view.PagerSlidingTabStrip.java
private void updateTabStyles() { for (int i = 0; i < tabCount; i++) { RelativeLayout tabLayout = (RelativeLayout) tabsContainer.getChildAt(i); View v = tabLayout.getChildAt(0); 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); ////from w w w .j a v a 2 s .c om // 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 (i == selectedPosition) { tab.setTextColor(selectedTabTextColor); } } } }
From source file:com.android.messaging.ui.ViewPagerTabs.java
private void addTab(CharSequence tabTitle, final int position) { final TextView textView = new TextView(getContext()); textView.setText(tabTitle);//from w w w.ja va 2 s . c o m textView.setBackgroundResource(R.drawable.contact_picker_tab_background_selector); textView.setGravity(Gravity.CENTER); textView.setOnClickListener(new OnClickListener() { @Override public void onClick(View v) { mPager.setCurrentItem(getRtlPosition(position)); } }); // Assign various text appearance related attributes to child views. if (mTextStyle > 0) { textView.setTypeface(textView.getTypeface(), mTextStyle); } if (mTextSize > 0) { textView.setTextSize(TypedValue.COMPLEX_UNIT_PX, mTextSize); } if (mTextColor != null) { textView.setTextColor(mTextColor); } textView.setAllCaps(mTextAllCaps); textView.setPadding(mSidePadding, 0, mSidePadding, 0); mTabStrip.addView(textView, new LinearLayout.LayoutParams(LayoutParams.WRAP_CONTENT, LayoutParams.MATCH_PARENT, 1)); // Default to the first child being selected if (position == 0) { mPrevSelected = 0; textView.setSelected(true); } }