litho
litho copied to clipboard
shadowElevation not working
When i use shadowElevationPx to set a row shadow like android elevation methods,but not show ,i don't know why.
The following is example code.
@LayoutSpec
public class TestSpec {
@OnCreateLayout
static Component onCreateLayout(ComponentContext c) {
return Row.create(c)
.heightPx(600)
.alignItems(YogaAlign.CENTER)
.justifyContent(YogaJustify.CENTER)
.child(Row.create(c)
.alignItems(YogaAlign.CENTER)
.justifyContent(YogaJustify.CENTER)
.shadowElevationPx(29)
.heightPx(300)
.widthPx(300)
.backgroundColor(Color.GREEN)
.child(SolidColor.create(c)
.heightPx(150)
.widthPx(150)
.color(Color.RED))
.build())
.build();
}
}
then lithoView.setComponent(Test.create(c).build());
how to set green area shadow?
Hey @xSharkM, I am not sure that you can apply shadowElevation*()
on a Component
that does not support elevation
at all!
How i can use elevation(shadows)? In my app i need to create TextBlock with shadow
you can create a Column/Row with shadow res as background like
Column.create(c)
.heightDip(4f)
.widthPercent(100f)
.backgroundRes(R.drawable.toolbar_layout_shadow)
.build()