android:update textnode shadow prop

This commit is contained in:
刘涛 2020-05-28 19:24:55 +08:00 committed by osborn
parent edb355da80
commit b81c1d824b
2 changed files with 19 additions and 1 deletions

View File

@ -223,6 +223,17 @@ public class TextNode extends ViewNode<TextView> {
} }
} }
break; break;
case "shadow":
if (prop.isObject()) {
mView.setAlpha((prop.asObject().getProperty("opacity").asNumber().toFloat()));
mView.setShadowLayer(
prop.asObject().getProperty("radius").asNumber().toFloat(),
DoricUtils.dp2px(prop.asObject().getProperty("offsetX").asNumber().toFloat()),
DoricUtils.dp2px(prop.asObject().getProperty("offsetY").asNumber().toFloat()),
prop.asObject().getProperty("color").asNumber().toInt()
);
}
break;
default: default:
super.blend(view, name, prop); super.blend(view, name, prop);
break; break;

View File

@ -11,8 +11,15 @@ class TextDemo extends Panel {
text: "This is normal text", text: "This is normal text",
}), }),
text({ text({
text: "This is normal text", text: "This is normal text with shadow ",
textSize: 20, textSize: 20,
shadow: {
color: Color.parse("#1DD6DE"),
offsetX: 0,
offsetY: 1,
opacity: 0.8,
radius: 3.0
}
}), }),
text({ text({
text: "This is normal text", text: "This is normal text",