List of usage examples for android.widget TextView setTextSize
public void setTextSize(int unit, float size)
From source file:com.do_an_httt.truon_000.jobssocialnetwork.view.SlidingTabLayoutEmployeeUpdate.java
/** * Create a default view to be used for tabs. This is called if a custom tab view is not set via * {@link #setCustomTabView(int, int)}.// w w w. j av a 2 s . c om */ protected TextView createDefaultTabView(Context context) { int width_device = getResources().getDisplayMetrics().widthPixels; TextView textView = new TextView(context); ViewGroup.LayoutParams params = new ViewGroup.LayoutParams(width_device / 2, ViewGroup.LayoutParams.MATCH_PARENT); textView.setLayoutParams(params); textView.setGravity(Gravity.CENTER); textView.setTextSize(TypedValue.COMPLEX_UNIT_SP, TAB_VIEW_TEXT_SIZE_SP); textView.setTypeface(Typeface.DEFAULT_BOLD); if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.HONEYCOMB) { // If we're running on Honeycomb or newer, then we can use the Theme's // selectableItemBackground to ensure that the View has a pressed state TypedValue outValue = new TypedValue(); getContext().getTheme().resolveAttribute(android.R.attr.selectableItemBackground, outValue, true); textView.setBackgroundResource(outValue.resourceId); } if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.ICE_CREAM_SANDWICH) { // If we're running on ICS or newer, enable all-caps to match the Action Bar tab style textView.setAllCaps(true); } int padding = (int) (TAB_VIEW_PADDING_DIPS * getResources().getDisplayMetrics().density); textView.setPadding(padding, padding, padding, padding); return textView; }
From source file:cn.bingoogol.tabhost.ui.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)); }// ww w. ja v a2 s . c om } if (i == selectedPosition) { tab.setTextColor(selectedTabTextColor); } } } }
From source file:com.contentful.discovery.ui.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.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)); }// w w w . j a v a2s. c om } } } }
From source file:com.dengfx.googleplay.view.astuetz.PagerSlidingTabStrip.java
/** * ?_???/* ww w . java 2 s. c o m*/ */ 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 source file:com.axolotl.yanews.customize.SlidingTabLayout.java
/** * tabview. tab view//from w w w. j a va 2s . co m * {@link #setCustomTabView(int, int)}. */ @TargetApi(Build.VERSION_CODES.ICE_CREAM_SANDWICH) protected TextView createDefaultTabView(Context context) { TextView textView = new TextView(context, null, 0); textView.setGravity(Gravity.CENTER); textView.setTextSize(TypedValue.COMPLEX_UNIT_SP, mTab_text_size_sp); if (mBold) { textView.setTypeface(Typeface.DEFAULT, Typeface.BOLD); } else { textView.setTypeface(Typeface.DEFAULT, Typeface.NORMAL); } if (mChangeTextColor) { textView.setTextColor(mNormalColor); } textView.setLayoutParams(new LinearLayout.LayoutParams(LinearLayout.LayoutParams.WRAP_CONTENT, LinearLayout.LayoutParams.MATCH_PARENT)); if (mBackgroundResource != 0) { textView.setBackgroundResource(mBackgroundResource); } else { if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.HONEYCOMB) { // If we're running on Honeycomb or newer, then we can use the Theme's // selectableItemBackground to ensure that the View has a pressed state TypedValue outValue = new TypedValue(); getContext().getTheme().resolveAttribute(android.R.attr.selectableItemBackground, outValue, true); textView.setBackgroundResource(outValue.resourceId); } } //wtf // if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.ICE_CREAM_SANDWICH) { // // If we're running on ICS or newer, enable all-caps to match the Action Bar tab style // textView.setAllCaps(true); // } int padding = (int) (TAB_VIEW_PADDING_DIPS * getResources().getDisplayMetrics().density); textView.setPadding(padding, 0, padding, 0); return textView; }
From source file:com.bitants.wally.fragments.MaterialDialogFragment.java
protected void setupViews(Context context) { if (titleResourceId != 0) { textViewTitle.setText(titleResourceId); } else if (titleString != null) { textViewTitle.setText(titleString); }//from ww w. j ava 2s .c o m if (primaryColor != 0) { buttonPositive.setTextColor(primaryColor); } if (positiveButtonTextResourceId != 0) { buttonPositive.setText(positiveButtonTextResourceId); } if (negativeButtonTextResourceId != 0) { buttonNegative.setText(negativeButtonTextResourceId); } buttonNegative.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { if (negativeButtonOnClickListener != null) { negativeButtonOnClickListener.onClick(null, 1); } dismiss(); } }); buttonPositive.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { if (positiveButtonOnClickListener != null) { positiveButtonOnClickListener.onClick(null, 0); } dismiss(); } }); if (layoutResourceId != 0) { viewStub.setLayoutResource(layoutResourceId); viewStub.inflate(); } else if (message != null || messageResourceId != 0) { TextView textView = new TextView(context); if (messageResourceId != 0) { textView.setText(messageResourceId); } else { textView.setText(message); } textView.setTextColor(getResources().getColor(R.color.Black_Light)); textView.setTextSize(TypedValue.COMPLEX_UNIT_SP, 16); textView.setLineSpacing(1f, 1.2f); scrollView.removeAllViews(); scrollView.addView(textView); } }
From source file:com.do_an_httt.truon_000.jobssocialnetwork.view.SlidingTabLayout.java
/** * Create a default view to be used for tabs. This is called if a custom tab view is not set via * {@link #setCustomTabView(int, int)}./*from w w w . j av a2 s . c o m*/ */ protected TextView createDefaultTabView(Context context) { int width_device = getResources().getDisplayMetrics().widthPixels; TextView textView = new TextView(context); ViewGroup.LayoutParams params = new ViewGroup.LayoutParams(width_device / 3, ViewGroup.LayoutParams.MATCH_PARENT); textView.setLayoutParams(params); textView.setGravity(Gravity.CENTER); textView.setTextSize(TypedValue.COMPLEX_UNIT_SP, TAB_VIEW_TEXT_SIZE_SP); textView.setTypeface(Typeface.DEFAULT_BOLD); if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.HONEYCOMB) { // If we're running on Honeycomb or newer, then we can use the Theme's // selectableItemBackground to ensure that the View has a pressed state TypedValue outValue = new TypedValue(); getContext().getTheme().resolveAttribute(android.R.attr.selectableItemBackground, outValue, true); textView.setBackgroundResource(outValue.resourceId); } if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.ICE_CREAM_SANDWICH) { // If we're running on ICS or newer, enable all-caps to match the Action Bar tab style textView.setAllCaps(true); } int padding = (int) (TAB_VIEW_PADDING_DIPS * getResources().getDisplayMetrics().density); textView.setPadding(padding, padding, padding, padding); return textView; }
From source file:com.app.sample.chatting.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, 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 a 2 s . c o m } } } }
From source file:com.dkt.pos.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()); // } // } }/* w ww . j a v a 2 s . c o m*/ } }
From source file:app.lib.beta.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)); }/* w w w. j a v a2 s .c o m*/ } } } }