-1

I want to create a custom View similar to this image. More specifically, the dark "number of riders" view. I don't want to use an image for background. I need a drawable xml for the background.

I am new to Android so any help would be appreciated.

Here is the required image

Phantômaxx
  • 37,901
  • 21
  • 84
  • 115
Rajat Porwal
  • 101
  • 8

1 Answers1

0

The best way to do that will be to use a 9-patch drawable file and set it as the background of the TextView. Here is how you can do that: http://en.miui.com/thread-26099-1-1.html

Or you can create an SVG and use that as background. The easiest way to do that would be to make a png image and convert it to SVG file using online converters. How to convert a PNG image to a SVG?

There is more complicated way to archive it like drawing on a canvas and using that as background, But I would recommend you to use 9-patch file.

Community
  • 1
  • 1
Lokesh Saini
  • 106
  • 1
  • 6
  • 1
    thank you for your answer @Lokesh but i have already mentioned that i don't want to use an image , I need a drawable xml for the background. – Rajat Porwal Oct 20 '16 at 12:13
  • That's what I wrote in 2nd option. You can generate an SVG from a PNG image and import it into your project. It will be vector drawable https://developer.android.com/studio/write/vector-asset-studio.html#svg – Lokesh Saini Oct 22 '16 at 20:15