本文整理汇总了Java中com.facebook.react.uimanager.ViewProps.FONT_STYLE属性的典型用法代码示例。如果您正苦于以下问题:Java ViewProps.FONT_STYLE属性的具体用法?Java ViewProps.FONT_STYLE怎么用?Java ViewProps.FONT_STYLE使用的例子?那么恭喜您, 这里精选的属性代码示例或许可以为您提供帮助。您也可以进一步了解该属性所在类com.facebook.react.uimanager.ViewProps
的用法示例。
在下文中一共展示了ViewProps.FONT_STYLE属性的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: setFontStyle
@ReactProp(name = ViewProps.FONT_STYLE)
public void setFontStyle(@Nullable String fontStyleString) {
final int fontStyle;
if (fontStyleString == null) {
fontStyle = -1;
} else if (ITALIC.equals(fontStyleString)) {
fontStyle = Typeface.ITALIC;
} else if (NORMAL.equals(fontStyleString)) {
fontStyle = Typeface.NORMAL;
} else {
throw new RuntimeException("invalid font style " + fontStyleString);
}
if (mFontStylingSpan.getFontStyle() != fontStyle) {
getSpan().setFontStyle(fontStyle);
notifyChanged(true);
}
}
示例2: setFontStyle
/**
/* This code was taken from the method setFontStyle of the class ReactTextShadowNode
/* TODO: Factor into a common place they can both use
*/
@ReactProp(name = ViewProps.FONT_STYLE)
public void setFontStyle(ReactEditText view, @Nullable String fontStyleString) {
int fontStyle = UNSET;
if ("italic".equals(fontStyleString)) {
fontStyle = Typeface.ITALIC;
} else if ("normal".equals(fontStyleString)) {
fontStyle = Typeface.NORMAL;
}
Typeface currentTypeface = view.getTypeface();
if (currentTypeface == null) {
currentTypeface = Typeface.DEFAULT;
}
if (fontStyle != currentTypeface.getStyle()) {
view.setTypeface(currentTypeface, fontStyle);
}
}
示例3: setFontStyle
/**
/* This code is duplicated in ReactTextInputManager
/* TODO: Factor into a common place they can both use
*/
@ReactProp(name = ViewProps.FONT_STYLE)
public void setFontStyle(@Nullable String fontStyleString) {
int fontStyle = UNSET;
if ("italic".equals(fontStyleString)) {
fontStyle = Typeface.ITALIC;
} else if ("normal".equals(fontStyleString)) {
fontStyle = Typeface.NORMAL;
}
if (fontStyle != mFontStyle) {
mFontStyle = fontStyle;
markUpdated();
}
}