Creating non-traditional shape tooltip in android with border - android

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)

Related

How can I achieve curly or wavy borders for a view on Android?

There is the concept of rounded corners for views and drawables in Android, however, am working on an interface for a kids robot, and someone asked for curly borders - sort of like wavy (sine wave kind of thing). Now, how the heck can one achieve such a thing in either XML or Java - especially, without resorting to use of image overlays or backgrounds?
rounded corners aren't in fact rounded Views, its just a bit of transparency in corners. you can create some custom drawables/Bitmaps and set for your Views (as a background or use ImageView) or you can use custom programmatic drawing like HERE
Have tried to use images of that form and use them as background in a transparent container?

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).

Button with dashed outline - 9patch with tileMode="repeat"?

I am having trying to accomplish this kind of a design. It needs to stretch to accomodate difference screens but rather then stretching it should repeat the pattern, I think the picture is pretty self-explanatory. 9patch only wont cut it as it only stretches.
Thanks for your time
The simplest method to do what you want would be to use a shape drawable with the stroke element set on it to obtain that dash pattern.
You may be able to also do it with a layer-list drawable.

Draw a gradient filled polygon to use in a selector

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.

Shape glass effect

I've created a custom toolbar using a gradient inside a shape. It looks very nice, but since we only have the option for 3 colors (startColor, centerColor, endColor) it looks very round. I would like to do a glass effect, which requires a sharp change in color in the middle. Basically I need 4 colors (startColor, justabovecenterColor, justbelowcenterColor, endColor). Now I could have two shapes sitting on top of each other to get this effect, but I don't want to do this. I'm getting into some tricky UI customization here and that would be very difficult to manage on different sized screens.
Does anyone know how I can create a glass effect?
Have you considered using a NinePatch ? This would be a quick and easy way to make a good looking, scalable set of shapes...

Categories

Resources