Timo Drick

    Timo Drick

    1 year ago
    I want to draw an icon with a shadow. I think this is not possible out of the box yet. But maybe it is possible to create a component which draw its child vectorDrawable with a tint and scales it up a little bit and do a blur filter on it. Anyone tried this already?
    Vsevolod Ganin

    Vsevolod Ganin

    1 year ago
    Maybe you want a
    Surface
    with custom
    Shape
    ? Inside surface you can draw whatever you want but the shadow will still be casted by the shape you provided. The shape gives outline for shadow and it could be as custom as some
    Path
    (see
    Outline.Generic
    ). But it will still use
    elevation
    parameter to control shadow position and other implicit attributes which could be undesired
    I didn’t try complicated cases though. My case was to render some round stuff with
    Canvas
    and make it cast shadow. So putting
    Canvas
    inside
    Surface
    and setting
    shape
    to
    CircleShape
    worked.
    Timo Drick

    Timo Drick

    1 year ago
    When i use e.g. a CircleShape or any other shape i get some thing like this:
    As you can see at the right icon for animation the shadow do have a white circle inside.
    So i do not really need the exact shape as shadow. But the shadow which is drawn by compose for a shape do not really work well for this use case
    So the real problem is that the shadow is not drawn inside of the shape