How do I draw a curve like this in xml res/drawable - android

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.

Related

How can I define a transparent circle with white background in an Android drawable file?

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.

Android: How to make inverted border radius?

How to make shape like on image?
Bottom left and right corners is simple. But top left and right corners...
radius="-10dp" won't work
For more complex shapes such as the one you are looking for you are better off using either vector or PNG resources than shape drawables.
Shape drawables are great for very simple shapes, but don't support a full suite of drawing options.

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.

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)

android - draw slope / slant line on a textview

hi,
I'm trying to implement something similar to the image attached. I have two textviews one on top of the other and i want their borders to look like the one in the image. I was able to draw rounded corners by setting the cornerradii of the GradientDrawable but i have no clue as in how to draw the slope on the right side of the first textview.
Any help on how to do this is much appreciated!!
thanks.
I would in this case do the graphics in a some graphics editing program (Photshop, GIMP or Inkscape for example). Two different drawings, one for the top part and one for the bottom. Then convert the drawings to NinePatchDrawable to be used as backgrounds for the text views. Since this type of drawable can be made larger or smaller depending on the length of the text in the TextViews.
You can use a transparent background image instead of drawing the background. Else you can use the canvas.
Edit : bad image example :-)

Categories

Resources