/** * @return the current typeface and style in which the text is being * displayed. * * @see #setTypeface(Typeface) * * @attr ref android.R.styleable#TextView_fontFamily * @attr ref android.R.styleable#TextView_typeface * @attr ref android.R.styleable#TextView_textStyle */ public Typeface getTypeface (){ return mInputView.getTypeface(); }
private void cloneEditText(EditText dstText, EditText srcText) { dstText.setText(srcText.getText()); dstText.setTextColor(srcText.getTextColors()); dstText.setTypeface(srcText.getTypeface()); dstText.setTextSize(TypedValue.COMPLEX_UNIT_PX, srcText.getTextSize()); } }
collapsingTextHelper.setTypefaces(this.editText.getTypeface());
@Override protected void afterHookedMethod(MethodHookParam param) throws PackageManager.NameNotFoundException { editText = (EditText) param.thisObject; if (!haveDefTypeface) { defTypeface = editText.getTypeface(); haveDefTypeface = true; } } });
EditText editText = (EditText) findViewById(R.id.editText); TextView textView = new TextView(this.getApplicationContext()); textView.setTypeface(editText.getTypeface()); textView.setText(editText.getText()); textView.measure( View.MeasureSpec.makeMeasureSpec(View.MeasureSpec.UNSPECIFIED, View.MeasureSpec.UNSPECIFIED), View.MeasureSpec.makeMeasureSpec(0, View.MeasureSpec.UNSPECIFIED)); textView.layout(0, 0, textView.getMeasuredWidth(), textView.getMeasuredHeight()); textView.setDrawingCacheEnabled(true); textView.buildDrawingCache(); Bitmap b = textView.getDrawingCache().copy(Bitmap.Config.ARGB_8888, false); textView.destroyDrawingCache(); try{ String path = Environment.getExternalStorageDirectory().toString() + "/picture.png"; OutputStream outputStream = new FileOutputStream(new File(path)); b.compress(Bitmap.CompressFormat.PNG, 0, outputStream); outputStream.flush(); outputStream.close(); } catch (Exception e) { e.printStackTrace(); }
Typeface oldTf = ((EditText)view).getTypeface(); ((EditText)view).setTypeface( Utils.substituteTypeface(oldTf, fallback, view.getClass().getName(), view.getId()) EditText et = ((TextInputLayout)view).getEditText(); if (et != null) { Typeface oldTf = et.getTypeface(); ((TextInputLayout)view).setTypeface( Utils.substituteTypeface(oldTf, fallback, view.getClass().getName(), view.getId())
final Typeface typeface = mEditText.getTypeface(); mEditText.setInputType(mEditConfig.inputType); mEditText.setTypeface(typeface);
final Typeface typeface = mEditText.getTypeface(); mEditText.setInputType(mEditConfig.inputType); mEditText.setTypeface(typeface);
if (padding != null) mEditText.setPadding(padding[0], padding[1], padding[2], padding[3]); mEditText.setTypeface(mEditText.getTypeface(), mInputParams.styleText);
paint.setTextAlign(Align.CENTER); paint.setTextSize(TEXT_SIZE_MAX); paint.setTypeface(mInputText.getTypeface()); ColorStateList colors = mInputText.getTextColors(); int color = colors.getColorForState(ENABLED_STATE_SET, Color.WHITE);
private void restoreTypography(CheckListView v, EditText returnView) { if (v.getEditText() != null) { returnView.setTypeface(v.getEditText().getTypeface()); returnView.setTextSize(0, v.getEditText().getTextSize()); returnView.setTextColor(v.getEditText().getTextColors()); returnView.setLinkTextColor(v.getEditText().getLinkTextColors()); } }
@SuppressLint("NewApi") @SuppressWarnings("deprecation") public void cloneStyles(EditText edittext) { if (edittext != null) { Drawable drawable = edittext.getBackground(); if (android.os.Build.VERSION.SDK_INT < 16) { getEditText().setBackgroundDrawable(drawable); } else { getEditText().setBackground(drawable); } getEditText().setTypeface(edittext.getTypeface()); getEditText().setTextSize(0, edittext.getTextSize()); getEditText().setTextColor(edittext.getTextColors()); getEditText().setLinkTextColor(edittext.getLinkTextColors()); } }