Android: font style for input

This commit is contained in:
王劲鹏 2023-01-12 11:09:37 +08:00 committed by osborn
parent 81c519dcdf
commit f7d9655213

View File

@ -181,6 +181,21 @@ public class InputNode extends ViewNode<EditText> implements TextWatcher, View.O
case "textAlignment":
view.setGravity(prop.asNumber().toInt());
break;
case "fontStyle":
if (prop.isString()) {
if ("bold".equals(prop.asString().value())) {
view.setTypeface(Typeface.defaultFromStyle(Typeface.BOLD));
} else if ("italic".equals(prop.asString().value())) {
view.setTypeface(Typeface.defaultFromStyle(Typeface.ITALIC));
} else if ("bold_italic".equals(prop.asString().value())) {
view.setTypeface(Typeface.defaultFromStyle(Typeface.BOLD_ITALIC));
} else {
view.setTypeface(Typeface.defaultFromStyle(Typeface.NORMAL));
}
} else {
view.setTypeface(Typeface.defaultFromStyle(Typeface.NORMAL));
}
break;
case "font":
if (!prop.isString()) {
return;