diff --git a/doric-android/doric/src/main/java/pub/doric/shader/TextNode.java b/doric-android/doric/src/main/java/pub/doric/shader/TextNode.java index 8ebc9fb5..479f980d 100644 --- a/doric-android/doric/src/main/java/pub/doric/shader/TextNode.java +++ b/doric-android/doric/src/main/java/pub/doric/shader/TextNode.java @@ -223,6 +223,17 @@ public class TextNode extends ViewNode { } } 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: super.blend(view, name, prop); break; diff --git a/doric-demo/src/TextDemo.ts b/doric-demo/src/TextDemo.ts index fa63029d..f3d73525 100644 --- a/doric-demo/src/TextDemo.ts +++ b/doric-demo/src/TextDemo.ts @@ -11,8 +11,15 @@ class TextDemo extends Panel { text: "This is normal text", }), text({ - text: "This is normal text", + text: "This is normal text with shadow ", textSize: 20, + shadow: { + color: Color.parse("#1DD6DE"), + offsetX: 0, + offsetY: 1, + opacity: 0.8, + radius: 3.0 + } }), text({ text: "This is normal text",