I'm trying to create a drawable that looks like the KitKat toast bacground:
but I have no idea how to recreate the fully round sides, I always end up with a rectangle with rounded edges like this:
or the sides aren't really round:
Any idea on how to accomplish this?
Btw, just setting the color of the Toast doesn't work.
Android 9-patch shadow generator
will help you achieve the desired 9patch, allowing you to customize the roundness of the sides to your liking.
"Fill & Outline" will also give you the ability to apply some color.
Do it like this:
This is the toast_frame_holo.9.png from Android-19 (HDPI)
Related
How would I go about drawing a shape like this? I can't just use a half circle, because I want the edges to have a nice concave feel as they even out to flat. After that I'm looking to add a border to just the top part. How could this be done in xml?
You wouldn't use xml for this. Use an image, possibly a vector drawable.
I'm trying to use a 9-patch png for a Spinner, but the image isn't stretching as expected. I used Android Asset Studio.
Here's what the Spinner looks like:
http://i.imgur.com/MOXCccq.jpg?1
and here's what the 9-patch looks like:
http://i.imgur.com/gd6ywAu.png
The placement of the image is correct (it should be in the bottom right of the spinner), but I'm not sure why the color distortion is occurring (I want the entire spinner to be white).
Any suggestions? Thanks.
Your 9-patch is the problem. Looks like you downscaled this from a larger source? During the downscaling, your edge pixels were aliased:
So your stretch points are actually on semi-transparent pixels. Just fix those edge pixels to be white again and you'll be good to go.
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.
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 was creating a border using this example:
Is there an easy way to add a border to the top and bottom of an Android View?
I was wonder is there anyway to make the border glow?
I want it to kind of look like this:
https://g1.gstatic.com/android/market/com.feelingtouch.glowsnake/ss-480-4-4
thanks!
Sure, just make a 9-patch and use it as the background.
https://developer.android.com/studio/write/draw9patch.html