I want to know how to draw this bubble in Android XML code. I want it as a shape drawable because I want to resize. I tried to make it on my own but what I got was only a triangle. I find it difficult to program this through xml so I need your help.
I cannot find something similar.
Related
What I have now is more like a ring. I would like to set the background outside the circle. Is that possible in xml drawable file? Thanks.
What I have now vs
What I would like to achieve
Looks like there is no easy way to do it in drawable file.
If you want to do it in customized view/layout, you can look at the answers in Draw a transparent circle onto a filled android canvas and Android canvas: draw transparent circle on image. Both work for me.
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)
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.
I am trying to create a drawable such as this in Android:
I don't think a nine patch will work because there is nowhere that can safety scale vertically. So next I tried a shape drawable but it does not support triangles.
I want to render this image on the fly so there are no artifacts. Also I want to be able to use it in a selector, so I need to be able to represent this image in xml. Maybe I need to extend some class to manually make the shape. If so how do I embed a tag in the xml to tell it where to render? Does anyone know where to start with this or have an example of something similar?
I have read the first 10 pages of hits on stack overflow and google and am not getting anywhere. Thanks very much for any help.
I think a 9-patch would work. For the vertical stretching on the left boundary, fill in the line from top to bottom.
Does anyone know how i can draw programmatically in android something like this (without using opengl)?
Pic
You can use shape drawables (circles and lines) to define elements and then combine them in one drawable with Layer List. All this can be defined in XML.