本文整理了Java中android.widget.TextView.isInEditMode()
方法的一些代码示例,展示了TextView.isInEditMode()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。TextView.isInEditMode()
方法的具体详情如下:
包路径:android.widget.TextView
类名称:TextView
方法名:isInEditMode
暂无
代码示例来源:origin: workarounds/typography
public static void setTypography(android.widget.TextView textView, AttributeSet attrs){
if(!textView.isInEditMode()) {
setTypeface(textView, attrs);
}
}
代码示例来源:origin: GrossumUA/TAS_Android_Boilerplate
public static void setupTypefaceToTextView(TextView tv, AttributeSet attrs) {
if (android.os.Build.VERSION.SDK_INT < Build.VERSION_CODES.LOLLIPOP) {
applyFixForPre21ver(tv);
}
if (!tv.isInEditMode() && attrs != null) {
TypedArray typedArray = tv.getContext().obtainStyledAttributes(
attrs,
R.styleable.CustomFontTextView);
final int fontIndex = typedArray.getInt(R.styleable.CustomFontTextView_customFontName, -1);
if (fontIndex < 0) {
typedArray.recycle();
throw new IllegalArgumentException("You must provide attribute \"customFontName\" for your CustomFontTextView");
} else {
final Typeface customTypeface = CustomFont.findByIndex(fontIndex).orElse(CustomFont.CLANT_OT_NARR_BOOK)
.asTypeface(tv.getContext());
tv.setTypeface(customTypeface);
typedArray.recycle();
}
}
}
代码示例来源:origin: neopixl/PixlUI
public static void onDrawHelper(Canvas canvas, TextView target, DrawCallback drawCallback) {
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.CUPCAKE) {
if (target.isInEditMode())
return;
}
final ExtraFontData data = getFontData(target, false);
if (data == null)
return;
if (data.borderWidth > 0) {
final Paint paint = target.getPaint();
// setup stroke
final Style oldStyle = paint.getStyle();
final ColorStateList oldTextColors = target.getTextColors();
final float oldStrokeWidth = paint.getStrokeWidth();
target.setTextColor(data.borderColor);
paint.setStyle(Style.STROKE);
paint.setStrokeWidth(data.borderWidth);
callDrawCallback(drawCallback, canvas);
target.setTextColor(oldTextColors);
paint.setStyle(oldStyle);
paint.setStrokeWidth(oldStrokeWidth);
}
}
内容来源于网络,如有侵权,请联系作者删除!