dismiss(); }); okButton.setTypeface(ResourcesCompat.getFont(activity, R.font.robotomedium)); if (mOkString != null) okButton.setText(mOkString); else okButton.setText(mOkResid); if (getDialog() != null) getDialog().cancel(); }); cancelButton.setTypeface(ResourcesCompat.getFont(activity, R.font.robotomedium)); if (mCancelString != null) cancelButton.setText(mCancelString); else cancelButton.setText(mCancelResid);
}); mOkButton.setOnKeyListener(keyboardListener); mOkButton.setTypeface(ResourcesCompat.getFont(context, R.font.robotomedium)); if(mOkString != null) mOkButton.setText(mOkString); else mOkButton.setText(mOkResid); if (getDialog() != null) getDialog().cancel(); }); mCancelButton.setTypeface(ResourcesCompat.getFont(context, R.font.robotomedium)); if(mCancelString != null) mCancelButton.setText(mCancelString); else mCancelButton.setText(mCancelResid);
button.setText(this.mStyle.buttonText != null ? this.mStyle.buttonText.toUpperCase() : ""); button.setTypeface(button.getTypeface(), this.mStyle.buttonTypefaceStyle); button.setTextColor(this.mStyle.buttonTextColor); button.setTextSize(this.mStyle.buttonTextSize);
mFlipCard.setTypeface(TypefaceHelper.get(this, "Roboto-Medium")); mFlipCardLayout = (LinearLayout) findViewById(R.id.flashcard_layout_flip); mFlipCardLayout.setOnClickListener(mFlipCardListener);
private void selectButton(Button button) { Context context = getContext(); TypedValue tv = new TypedValue(); boolean found = context.getTheme().resolveAttribute(android.R.attr.textColor, tv, true); @ColorInt int primaryColor = found ? tv.data : Color.BLACK; button.setTypeface(null, Typeface.BOLD); button.setTextColor(primaryColor); }
public static boolean setCustomFont(View view, Context ctx, String asset) { if (TextUtils.isEmpty(asset)) return false; Typeface tf = null; try { tf = getFont(ctx, asset); if (view instanceof TextView) { ((TextView) view).setTypeface(tf); } else { ((Button) view).setTypeface(tf); } } catch (Exception e) { Log.e("AppUtil", "Could not get typface " + asset); return false; } return true; }
/** * Adapts the typeface of the dialog's buttons. */ private void adaptButtonTypeface() { if (buttonTypeface != null) { if (positiveButton != null) { positiveButton.setTypeface(buttonTypeface); } if (neutralButton != null) { neutralButton.setTypeface(buttonTypeface); } if (negativeButton != null) { negativeButton.setTypeface(buttonTypeface); } } }
Typeface myTypeface = Typeface.createFromAsset(getAssets(), "fonts/your_font.ttf"); Button custom_btn = (Button) findViewById(R.id.btn); custom_btn.setTypeface(myTypeface); custom_btn.setOnClickListener(this);
public static void setTypefaceLight(Context context, Button button) { mNunitoTypeFace = Typeface.createFromAsset(context.getAssets(), "fonts/NunitoSans-SemiBold.ttf"); button.setTypeface(mNunitoTypeFace); } }
public static void setTypefaceSemiBold(Context context, Button button) { mNunitoTypeFace = Typeface.createFromAsset(context.getAssets(), "fonts/NunitoSans-Light.ttf"); button.setTypeface(mNunitoTypeFace); }
public static void setTypefaceBold(Context context, Button button) { mNunitoTypeFace = Typeface.createFromAsset(context.getAssets(), "fonts/NunitoSans-Bold.ttf"); button.setTypeface(mNunitoTypeFace); }
@Override public void setTypeface(final Typeface tf, final int style) { super.setTypeface(tf, style); updateUI(); }
@Override public void setTypeface(final Typeface tf) { super.setTypeface(tf); updateUI(); }
private void setFontLocale(Button b, String locale) { Log.i(Constants.TAG, "NotificationActivity setFontLocale Button: " + locale); if (locale.contains("iw")) { Typeface face = Typeface.createFromAsset(getAssets(), "fonts/DroidSansFallback.ttf"); b.setTypeface(face); } }
/** * Sets the typeface style of the button in a BUTTON * {@link com.github.johnpersano.supertoasts.SuperToast.Type} {@value #TAG}. * * @param typefaceStyle {@link android.graphics.Typeface} */ public void setButtonTypefaceStyle(int typefaceStyle) { if (mType != Type.BUTTON) { Log.e(TAG, "setButtonTypefaceStyle()" + ERROR_NOTBUTTONTYPE); } if (mButton != null) { mButtonTypefaceStyle = typefaceStyle; mButton.setTypeface(mButton.getTypeface(), typefaceStyle); } }
/** * Sets the typeface style of the button in a BUTTON * {@link com.github.johnpersano.supertoasts.SuperToast.Type} {@value #TAG}. * * @param typefaceStyle {@link android.graphics.Typeface} */ public void setButtonTypefaceStyle(int typefaceStyle) { if (mType != Type.BUTTON) { Log.w(TAG, "setButtonTypefaceStyle()" + ERROR_NOTBUTTONTYPE); } if (mButton != null) { mButtonTypefaceStyle = typefaceStyle; mButton.setTypeface(mButton.getTypeface(), typefaceStyle); } }
public static void setFontInTag(ViewGroup root, String tag, Typeface font) { ArrayList<View> regularViews = getViewsByTag(root, tag); for (View view : regularViews) { if (view.getClass() == TextView.class) { TextView text = (TextView) view; text.setTypeface(font); } else if (view.getClass() == Button.class) { Button text = (Button) view; text.setTypeface(font); } else if (view.getClass() == ToggleButton.class) { ToggleButton text = (ToggleButton) view; text.setTypeface(font); } else if (view.getClass() == EditText.class) { EditText text = (EditText) view; text.setTypeface(font); } } }
private void findViews() { toolbar = (Toolbar) findViewById(R.id.toolbar); txtName = (TextView) findViewById(R.id.txt_name); txtMobile = (TextView) findViewById(R.id.txt_mobile); btnUserType = (Button) findViewById(R.id.btn_user_type); txtName.setTypeface(getTypeface()); txtMobile.setTypeface(getTypeface()); btnUserType.setTypeface(getTypeface()); btnUserType.setOnClickListener(this); txtMobile.setOnClickListener(this); }
public void dialogCreation(int arg0) { // custom dialog final Dialog dialog = new Dialog(context,R.style.cust_dialog); dialog.requestWindowFeature(Window.FEATURE_NO_TITLE); dialog.setContentView(R.layout.custom_dialog); // set the custom dialog components - text, image and button TextView text = (TextView) dialog.findViewById(R.id.dialog_text); text.setTypeface(FontFactory.getBFantezy(getBaseContext())); text.setText(Html.fromHtml(getStrint(arg0)); Button dialogButton = (Button) dialog.findViewById(R.id.dialog_Button); dialogButton.setTypeface(FontFactory.getBFantezy(getBaseContext())); dialogButton.setOnClickListener(new OnClickListener() { public void onClick(View v) { dialog.dismiss(); } }); dialog.show(); }
private void findViews(View view) { edtFirstName = (EditText) view.findViewById(R.id.edt_first_name); edtLastName = (EditText) view.findViewById(R.id.edt_last_name); edtMobile = (EditText) view.findViewById(R.id.edt_mobile); edtEmail = (EditText) view.findViewById(R.id.edt_email); edtPass = (EditText) view.findViewById(R.id.edt_pass); btnSignup = (Button) view.findViewById(R.id.btn_signup); spinnerUserType = (Spinner) view.findViewById(R.id.spinner_user_type); edtMobile.setTypeface(getTypeface()); edtFirstName.setTypeface(getTypeface()); edtLastName.setTypeface(getTypeface()); edtEmail.setTypeface(getTypeface()); edtPass.setTypeface(getTypeface()); btnSignup.setTypeface(getTypeface()); btnSignup.setOnClickListener(this); }