Draw shadow layer on vector drawable icon Android - android

I'm using basic vector icon from android vector asset :
I would like to create a shadow effect around my icons but everything I found seems not working.
I want to keep the vector as original and only add shadow layer as one we can create with Paint
How can it be done for any image ?

The answer was provided by someone who decided to remove his post for some reasons.
The DevLight - ShadowLayout library is exactly what I was looking for.

Related

How to create button with blurred drop shadow in Android Studio

I know this question is a duplicate, but I have not found the answer. So, is it possible to create a barely visible blurred shadow from a button in Android Studio? I found an example of a button with the shadow I need. How to make such a shadow so that it is adaptable to each size of the button? Thx.
you have few ways to achieve this. easiest would be to create 9-patch from an image, read carefully how to in official DOC. most pro would be to write own blurring code with probably most efficient for this purpose RenderScript. IN HERE you can find useful article how to blur images with this tool
you can always implement common material-design-styled Button using elevation/translationZ for increasing size of rendered-by-default shadow, but afaik there is no option for changing its color...

Custom shape design for button in android

I'm trying to create a shape for Button that would have one side round and other right side slop , the actual image and a shadow.
I'm tried alot but i'm not understand how to draw it and how to draw shadow for same.
Thanks in advance.
Design the shape whatever you want in any designing tool, export it as SVG. Then, in android studio right click on "drawable" folder -> new vector asset, then choose the exported SVG file from your local disc.
Now you can able to set the created drawable as button background.
Here is the information about custom buttons. In a different approach you can use canvas and onClickListener.

Draw specific shadow in Android

I'm looking for way how to implement specific shadow (like on picture) in my android app Android, with using xml (I can't use 9 patch for this).
This is white rectangle with the same shadow in all directions.
Any idea?
As far as I know, there's no way to create a shadow efficiently with XML without using 9-patch image. You can try playing with shapes and gradients, but the result won't look good.
I also did some tests by adding several shapes with transparent borders, but again the result is not good.
Can you explain your situation (why can't you use 9-patch, which is well supported by android).

Creating non-traditional shape tooltip in android with border

Hello fellow Android designers,
I am struggling right now to create xml tooltip that would look like the one on this picture:
Unfortunately it seems like a hell of a work. Till now I was only able to create a simple rounded rectangle like that:
Is it actually possible to create such a shape I have presented on the first photo using xml styling or should I try to create it programatically (which will probably take huge amount of time and creating border would be really hard)? Or maybe the simplest solution is the best and I should use partially transparent png image with the shape of my choosing?
Any advice would be much appreciated.
You can draw it using stretchable 9-patch drawable.
You can specify there which parts are fixed (the little knob on the left and corners) and which are stretchable (all other parts)

drawing non rectangular shapes on android

I am try to implement this shape with android xml drawables:
I am able to get the rectangle but I can figure out to get the triangle tip. I also need to apply a gradient to this shape.
Any help is greatly appreciated.
I think leveraging XML drawables is to create a clipping-mask via 9-patch drawable and then project that onto a rectangle drawable.
This probably will require a custom drawable class though. I searched and found that this Q/A might solve that part of the problem. Masking a Drawable/Bitmap on Android
Looking at the SDK docs ClipDrawable implies that it would help with that but it turns out that it might be a poorly named class. It doesn't do what I thought it would.
The easier way to accomplish this is to just create a 9-patch out of the object itself. You lose the gradient flexibility unfortunately when you do this.
You can use 9-patch to draw it.
http://developer.android.com/tools/help/draw9patch.html
just crop a little path around with triangle tips and make 9-patch like this check this link and then use drawable shape to draw your gradient on top of it.

Categories

Resources