List of usage examples for android.graphics Typeface DEFAULT_BOLD
Typeface DEFAULT_BOLD
To view the source code for android.graphics Typeface DEFAULT_BOLD.
Click Source Link
From source file:com.luckybuy.ctrls.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 a v a2 s . c o m*/ */ protected RadioButton createDefaultTabView(Context context) { RadioButton rbTab = new RadioButton(context); rbTab.setGravity(Gravity.CENTER); rbTab.setTextSize(TypedValue.COMPLEX_UNIT_PX, mTabTextSize); rbTab.setTypeface(Typeface.DEFAULT_BOLD); rbTab.setButtonDrawable(new ColorDrawable(Color.TRANSPARENT)); if (mTabLayoutEven) { LinearLayout.LayoutParams layoutParams = new RadioGroup.LayoutParams(0, ViewGroup.LayoutParams.MATCH_PARENT, 1); rbTab.setLayoutParams(layoutParams); } if (mTabColorStateList != -1) { rbTab.setTextColor(getResources().getColorStateList(mTabColorStateList)); } 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); rbTab.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 rbTab.setAllCaps(true); } int padding = (int) (mTabTextPadding * getResources().getDisplayMetrics().density); rbTab.setPadding(padding, 0, padding, 0); return rbTab; }
From source file:com.lfant.tabdemo.SlidingTabLayout.java
private void populateTabStrip() { final PagerAdapter adapter = mViewPager.getAdapter(); final View.OnClickListener tabClickListener = new TabClickListener(); for (int i = 0; i < adapter.getCount(); i++) { View tabView = null;//from w ww.j a va2s . c o m TextView tabTitleView = null; if (mTabViewLayoutId != 0) { // If there is a custom tab view layout id set, try and inflate it tabView = LayoutInflater.from(getContext()).inflate(mTabViewLayoutId, mTabStrip, false); tabTitleView = (TextView) tabView.findViewById(mTabViewTextViewId); } if (tabView == null) { tabView = createDefaultTabView(getContext()); } if (tabTitleView == null && TextView.class.isInstance(tabView)) { tabTitleView = (TextView) tabView; } if (mDistributeEvenly) { LinearLayout.LayoutParams lp = (LinearLayout.LayoutParams) tabView.getLayoutParams(); lp.width = 0; lp.weight = 1; } tabTitleView.setText(adapter.getPageTitle(i)); tabView.setOnClickListener(tabClickListener); String desc = mContentDescriptions.get(i, null); if (desc != null) { tabView.setContentDescription(desc); } mTabStrip.addView(tabView); if (i == mViewPager.getCurrentItem()) { tabView.setSelected(true); } tabTitleView.setTextColor(getResources().getColorStateList(R.color.selector)); Typeface tf = Typeface.createFromAsset(getContext().getAssets(), "fonts/Lucida-Grande-Regular.ttf"); tabTitleView.setTypeface(Typeface.DEFAULT_BOLD); tabTitleView.setTextSize(14); } }
From source file:com.viewsforandroid.foundry.sample.indicators.NumericPageIndicator.java
@SuppressWarnings("deprecation") public NumericPageIndicator(Context context, AttributeSet attrs, int defStyle) { super(context, attrs, defStyle); if (isInEditMode()) { return;/* ww w . j ava 2 s .co m*/ } // Load defaults from resources final Resources res = getResources(); final int defaultTextColor = res.getColor(R.color.default_page_number_indicator_text_color); final int defaultPageNumberTextColor = res .getColor(R.color.default_page_number_indicator_page_number_text_color); final boolean defaultPageNumberTextBold = res .getBoolean(R.bool.default_page_number_indicator_page_number_text_bold); final int defaultButtonPressedColor = res .getColor(R.color.default_page_number_indicator_pressed_button_color); final float defaultTopPadding = res.getDimension(R.dimen.default_page_number_indicator_top_padding); final float defaultBottomPadding = res.getDimension(R.dimen.default_page_number_indicator_bottom_padding); final float defaultTextSize = res.getDimension(R.dimen.default_page_number_indicator_text_size); final boolean defaultShowChangePageButtons = res .getBoolean(R.bool.default_page_number_indicator_show_change_page_buttons); final boolean defaultShowStartEndButtons = res .getBoolean(R.bool.default_page_number_indicator_show_start_end_buttons); // Retrieve styles attributes final TypedArray a = context.obtainStyledAttributes(attrs, R.styleable.NumericPageIndicator, defStyle, 0); mTextTemplate = a.getString(R.styleable.NumericPageIndicator_textTemplate); if (mTextTemplate == null) { mTextTemplate = res.getString(R.string.default_page_number_indicator_text_template); ; } parseTextTemplate(); mTextStartButton = a.getString(R.styleable.NumericPageIndicator_startButtonText); if (mTextStartButton == null) { mTextStartButton = res.getString(R.string.default_page_number_indicator_start_button_text); } mTextEndButton = a.getString(R.styleable.NumericPageIndicator_endButtonText); if (mTextEndButton == null) { mTextEndButton = res.getString(R.string.default_page_number_indicator_end_button_text); } mTextPreviousButton = a.getString(R.styleable.NumericPageIndicator_previousButtonText); if (mTextPreviousButton == null) { mTextPreviousButton = res.getString(R.string.default_page_number_indicator_previous_button_text); } mTextNextButton = a.getString(R.styleable.NumericPageIndicator_nextButtonText); if (mTextNextButton == null) { mTextNextButton = res.getString(R.string.default_page_number_indicator_next_button_text); } mColorText = a.getColor(R.styleable.NumericPageIndicator_android_textColor, defaultTextColor); mColorPageNumberText = a.getColor(R.styleable.NumericPageIndicator_pageNumberTextColor, defaultPageNumberTextColor); mPageNumberTextBold = a.getBoolean(R.styleable.NumericPageIndicator_pageNumberTextBold, defaultPageNumberTextBold); mColorPressedButton = a.getColor(R.styleable.NumericPageIndicator_pressedButtonColor, defaultButtonPressedColor); mPaddingTop = a.getDimension(R.styleable.NumericPageIndicator_android_paddingTop, defaultTopPadding); mPaddingBottom = a.getDimension(R.styleable.NumericPageIndicator_android_paddingBottom, defaultBottomPadding); mPaintText.setColor(mColorText); mShowChangePageButtons = a.getBoolean(R.styleable.NumericPageIndicator_showChangePageButtons, defaultShowChangePageButtons); mShowStartEndButtons = a.getBoolean(R.styleable.NumericPageIndicator_showStartEndButtons, defaultShowStartEndButtons); mPaintButtonBackground.setColor(mColorPressedButton); final float textSize = a.getDimension(R.styleable.NumericPageIndicator_android_textSize, defaultTextSize); mPaintText.setTextSize(textSize); mPaintText.setAntiAlias(true); mPaintPageNumberText.setColor(mColorPageNumberText); mPaintPageNumberText.setTextSize(textSize); mPaintPageNumberText.setAntiAlias(true); if (mPageNumberTextBold) { mPaintPageNumberText.setTypeface(Typeface.DEFAULT_BOLD); } final Drawable background = a.getDrawable(R.styleable.NumericPageIndicator_android_background); if (background != null) { setBackgroundDrawable(background); } a.recycle(); }
From source file:example.example.com.sportsofficial.presentation.views.ViewTabs.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, int)}. *//* ww w . j a va 2s . c o m*/ protected TextView createDefaultTextTabView(Context context) { TextView textView = new TextView(context); 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); System.out.println("c " + titleColor); if (titleColor != null) { textView.setTextColor(titleColor); } return textView; }
From source file:com.facebook.widget.LoginTextView.java
/** * Create the LoginButton by inflating from XML * /* w ww . j av a 2 s .c o m*/ * @see View#View(Context, AttributeSet) */ public LoginTextView(Context context, AttributeSet attrs) { super(context, attrs); if (attrs.getStyleAttribute() == 0) { // apparently there's no method of setting a default style in xml, // so in case the users do not explicitly specify a style, we need // to use sensible defaults. // this.setGravity(Gravity.LEFT); // this.setTextColor(getResources().getColor( // R.color.com_facebook_loginview_text_color)); // this.setTextSize(TypedValue.COMPLEX_UNIT_PX, getResources() // .getDimension(R.dimen.com_facebook_loginview_text_size)); this.setTypeface(Typeface.DEFAULT_BOLD); // if (isInEditMode()) { // // cannot use a drawable in edit mode, so setting the background // // color instead // // of a background resource. // // this.setBackgroundColor(getResources().getColor(R.color.com_facebook_blue)); // // hardcoding in edit mode as getResources().getString() doesn't // // seem to work in IntelliJ // loginText = "Log in with Facebook"; // } else { // // this.setBackgroundResource(R.drawable.btn_register_fb); // this.setCompoundDrawablesWithIntrinsicBounds( // R.drawable.com_facebook_inverse_icon, 0, 0, 0); // this.setCompoundDrawablePadding(getResources() // .getDimensionPixelSize( // R.dimen.com_facebook_loginview_compound_drawable_padding)); // this.setPadding( // getResources().getDimensionPixelSize( // R.dimen.com_facebook_loginview_padding_left), // getResources().getDimensionPixelSize( // R.dimen.com_facebook_loginview_padding_top), // getResources().getDimensionPixelSize( // R.dimen.com_facebook_loginview_padding_right), // getResources().getDimensionPixelSize( // R.dimen.com_facebook_loginview_padding_bottom)); // } } parseAttributes(attrs); if (!isInEditMode()) { initializeActiveSessionWithCachedToken(context); } }
From source file:com.facebook.widget.ToggleButtonLogin.java
/** * Create the LoginButton by inflating from XML * /*from w ww . j a v a 2s. c o m*/ * @see View#View(Context, AttributeSet) */ public ToggleButtonLogin(Context context, AttributeSet attrs) { super(context, attrs); if (attrs.getStyleAttribute() == 0) { // apparently there's no method of setting a default style in xml, // so in case the users do not explicitly specify a style, we need // to use sensible defaults. // this.setGravity(Gravity.LEFT); // this.setTextColor(getResources().getColor( // R.color.com_facebook_loginview_text_color)); // this.setTextSize(TypedValue.COMPLEX_UNIT_PX, getResources() // .getDimension(R.dimen.com_facebook_loginview_text_size)); this.setTypeface(Typeface.DEFAULT_BOLD); // if (isInEditMode()) { // // cannot use a drawable in edit mode, so setting the background // // color instead // // of a background resource. // // this.setBackgroundColor(getResources().getColor(R.color.com_facebook_blue)); // // hardcoding in edit mode as getResources().getString() doesn't // // seem to work in IntelliJ // loginText = "Log in with Facebook"; // } else { // // this.setBackgroundResource(R.drawable.btn_register_fb); // this.setCompoundDrawablesWithIntrinsicBounds( // R.drawable.com_facebook_inverse_icon, 0, 0, 0); // this.setCompoundDrawablePadding(getResources() // .getDimensionPixelSize( // R.dimen.com_facebook_loginview_compound_drawable_padding)); // this.setPadding( // getResources().getDimensionPixelSize( // R.dimen.com_facebook_loginview_padding_left), // getResources().getDimensionPixelSize( // R.dimen.com_facebook_loginview_padding_top), // getResources().getDimensionPixelSize( // R.dimen.com_facebook_loginview_padding_right), // getResources().getDimensionPixelSize( // R.dimen.com_facebook_loginview_padding_bottom)); // } } parseAttributes(attrs); if (!isInEditMode()) { initializeActiveSessionWithCachedToken(context); } }
From source file:com.facebook.widget.NoBGLoginButton.java
/** * Create the LoginButton by inflating from XML * /*from w w w.j a va2 s .com*/ * @see View#View(Context, AttributeSet) */ public NoBGLoginButton(Context context, AttributeSet attrs) { super(context, attrs); if (attrs.getStyleAttribute() == 0) { // apparently there's no method of setting a default style in xml, // so in case the users do not explicitly specify a style, we need // to use sensible defaults. this.setGravity(Gravity.CENTER); this.setTextColor(getResources().getColor(R.color.com_facebook_loginview_text_color)); this.setTextSize(TypedValue.COMPLEX_UNIT_PX, getResources().getDimension(R.dimen.com_facebook_loginview_text_size)); this.setTypeface(Typeface.DEFAULT_BOLD); if (isInEditMode()) { // cannot use a drawable in edit mode, so setting the background // color instead // of a background resource. // this.setBackgroundColor(getResources().getColor(R.color.com_facebook_blue)); // hardcoding in edit mode as getResources().getString() doesn't // seem to work in IntelliJ loginText = "Log in with Facebook"; } else { this.setBackgroundResource(android.R.color.white); this.setCompoundDrawablePadding(getResources() .getDimensionPixelSize(R.dimen.com_facebook_loginview_compound_drawable_padding)); this.setPadding(getResources().getDimensionPixelSize(R.dimen.com_facebook_loginview_padding_left), getResources().getDimensionPixelSize(R.dimen.com_facebook_loginview_padding_top), getResources().getDimensionPixelSize(R.dimen.com_facebook_loginview_padding_right), getResources().getDimensionPixelSize(R.dimen.com_facebook_loginview_padding_bottom)); } } parseAttributes(attrs); if (!isInEditMode()) { initializeActiveSessionWithCachedToken(context); } }
From source file:com.sina.android.weibo.sdk.widget.LoginoutButton.java
/** * ??/* w ww .j a v a2 s. com*/ * * @param attrs XML ? */ private void loadDefaultStyle(AttributeSet attrs) { if (attrs != null && 0 == attrs.getStyleAttribute()) { Resources res = getResources(); this.setBackgroundResource(R.drawable.com_sina_weibo_sdk_button_blue); this.setPadding(res.getDimensionPixelSize(R.dimen.com_sina_weibo_sdk_loginview_padding_left), res.getDimensionPixelSize(R.dimen.com_sina_weibo_sdk_loginview_padding_top), res.getDimensionPixelSize(R.dimen.com_sina_weibo_sdk_loginview_padding_right), res.getDimensionPixelSize(R.dimen.com_sina_weibo_sdk_loginview_padding_bottom)); this.setCompoundDrawablesWithIntrinsicBounds(R.drawable.ic_com_sina_weibo_sdk_logo, 0, 0, 0); this.setCompoundDrawablePadding( res.getDimensionPixelSize(R.dimen.com_sina_weibo_sdk_loginview_compound_drawable_padding)); this.setTextColor(res.getColor(R.color.com_sina_weibo_sdk_loginview_text_color)); this.setTextSize(TypedValue.COMPLEX_UNIT_PX, res.getDimension(R.dimen.com_sina_weibo_sdk_loginview_text_size)); this.setTypeface(Typeface.DEFAULT_BOLD); this.setGravity(Gravity.CENTER); this.setText(R.string.com_sina_weibo_sdk_login_with_weibo_account); } }
From source file:com.facebook.widget.GiftTransactionButton.java
/** * Create the LoginButton by inflating from XML * //from w w w . j a va 2 s . co m * @see View#View(Context, AttributeSet) */ public GiftTransactionButton(Context context, AttributeSet attrs) { super(context, attrs); if (attrs.getStyleAttribute() == 0) { // apparently there's no method of setting a default style in xml, // so in case the users do not explicitly specify a style, we need // to use sensible defaults. this.setGravity(Gravity.CENTER); this.setTextColor(getResources().getColor(R.color.com_facebook_loginview_text_color)); this.setTextSize(TypedValue.COMPLEX_UNIT_PX, getResources().getDimension(R.dimen.com_facebook_loginview_text_size)); this.setTypeface(Typeface.DEFAULT_BOLD); if (isInEditMode()) { // cannot use a drawable in edit mode, so setting the background // color instead // of a background resource. // this.setBackgroundColor(getResources().getColor(R.color.com_facebook_blue)); // hardcoding in edit mode as getResources().getString() doesn't // seem to work in IntelliJ loginText = "Log in with Facebook"; } else { this.setBackgroundResource(R.drawable.btn_doiqua); this.setCompoundDrawablePadding(getResources() .getDimensionPixelSize(R.dimen.com_facebook_loginview_compound_drawable_padding)); // this.setPadding( // getResources().getDimensionPixelSize( // R.dimen.com_facebook_loginview_padding_left), // getResources().getDimensionPixelSize( // R.dimen.com_facebook_loginview_padding_top), // getResources().getDimensionPixelSize( // R.dimen.com_facebook_loginview_padding_right), // getResources().getDimensionPixelSize( // R.dimen.com_facebook_loginview_padding_bottom)); } } parseAttributes(attrs); if (!isInEditMode()) { initializeActiveSessionWithCachedToken(context); } }
From source file:com.facebook.widget.LoginButtonDefault.java
/** * Create the LoginButton by inflating from XML * //from w w w. ja v a2 s . c om * @see View#View(Context, AttributeSet) */ public LoginButtonDefault(Context context, AttributeSet attrs) { super(context, attrs); if (attrs.getStyleAttribute() == 0) { // apparently there's no method of setting a default style in xml, // so in case the users do not explicitly specify a style, we need // to use sensible defaults. this.setGravity(Gravity.CENTER); this.setTextColor(getResources().getColor(R.color.com_facebook_loginview_text_color)); this.setTextSize(TypedValue.COMPLEX_UNIT_PX, getResources().getDimension(R.dimen.com_facebook_loginview_text_size)); this.setTypeface(Typeface.DEFAULT_BOLD); if (isInEditMode()) { // cannot use a drawable in edit mode, so setting the background // color instead // of a background resource. this.setBackgroundColor(getResources().getColor(R.color.com_facebook_blue)); // hardcoding in edit mode as getResources().getString() doesn't // seem to work in IntelliJ loginText = "Log in with Facebook"; } else { this.setBackgroundResource(R.drawable.com_facebook_button_blue); this.setCompoundDrawablesWithIntrinsicBounds(R.drawable.com_facebook_inverse_icon, 0, 0, 0); this.setCompoundDrawablePadding(getResources() .getDimensionPixelSize(R.dimen.com_facebook_loginview_compound_drawable_padding)); this.setPadding(getResources().getDimensionPixelSize(R.dimen.com_facebook_loginview_padding_left), getResources().getDimensionPixelSize(R.dimen.com_facebook_loginview_padding_top), getResources().getDimensionPixelSize(R.dimen.com_facebook_loginview_padding_right), getResources().getDimensionPixelSize(R.dimen.com_facebook_loginview_padding_bottom)); } } parseAttributes(attrs); if (!isInEditMode()) { initializeActiveSessionWithCachedToken(context); } }