Questions tagged [xml-drawable]

Solid drawables in android, these drawables are placed in 'drawable' folder inside 'res' folder, these are saved as xml files

266 questions
63
votes
4 answers

Using drawable resources

I have this problem, see the trace stack: E/AndroidRuntime(2410): Caused by: org.xmlpull.v1.XmlPullParserException: Binary XML file line #5: requires a valid src attribute My xml file looks like:
Alexander Gubarets
  • 653
  • 1
  • 5
  • 7
60
votes
2 answers

Understanding Android's

I don't understand how the layer-lists work. I read the official documentation with some examples but it does not work for me like expected. I want four squares which should be padded with 1dp, but nothing is like expected. Here is a screenshot…
rekire
  • 45,039
  • 29
  • 149
  • 249
49
votes
4 answers

BitmapFactory.decodeResource() returns null for shape defined in xml drawable

I looked through multiple similar questions, although I haven't found a proper answer to my issue. I have a drawable, defined in shape.xml
mol
  • 2,348
  • 4
  • 18
  • 34
43
votes
5 answers

Android shape border with gradient

I want to create a border for a linearLayout. So I decide to create a shape. I want the border to have a gradient. The following is not doing it. It fills the rectangle and then creates a stroke. I don't want a filled rectangle, just the stroke. And…
learner
  • 11,452
  • 24
  • 87
  • 160
42
votes
10 answers

How to preview xml drawable?

I'm working on pretty complex xml drawable and i was wondering if there is any tool/plugins which allow me to preview my drawable ? I'm looking for something similar to the "Graphical layout" tab available for layout. For example if i have something…
grunk
  • 13,700
  • 12
  • 61
  • 103
39
votes
5 answers

how to get android gradient center light effect?

i want something like following image i tried it using drawable shape
Ajeet47
  • 1,711
  • 1
  • 13
  • 18
36
votes
2 answers

How to use a shape drawable together with an image?

I have this difficulty to have both rounded corner and a background image in my LinearLayout. I know I can achive the rounded corner by using the shape drawable XML, but if I put the shape drawable as the background of my LinearLayout with…
Surya Wijaya Madjid
  • 1,794
  • 1
  • 16
  • 24
32
votes
2 answers

Android: How to Make A Drawable Selector

I feel like this is kind of a silly question, but here I go anyways. I have an image button, and I want to be able to change it's image everytime it is clicked. The API seems to say that the best way to go about doing this is to create xml…
aamiri
  • 2,260
  • 4
  • 31
  • 57
31
votes
2 answers

Android button select and press drawable

I'm trying to make a button with state press and select, I already did the same with tabs and it works but I don't know why here does not work. I have done it like this: button_sel.xml
croigsalvador
  • 1,965
  • 2
  • 23
  • 46
30
votes
3 answers

Dotted line is actually not dotted when app is running on real Android device

in my app I use XML defined vertical dotted line.
simekadam
  • 7,034
  • 10
  • 49
  • 75
30
votes
2 answers

Android dashed line drawable potential ICS bug

The following is a dashed line, defined as a ShapeDrawable in XML:
Chris Horner
  • 1,806
  • 2
  • 13
  • 22
29
votes
3 answers

how to add shadow effect on drawable in android

I have created chat bubble with drawable which looks fine, now I want to add shadow effect below the drawable so it make 3d effect.I don't want to use 9-pitch image. I just want to know how i can add shadow effect on this drawable. my code is…
maddy d
  • 1,434
  • 1
  • 12
  • 22
26
votes
2 answers

Change shape border color at runtime

I have this shape in my drawable folder:
Zelter Ady
  • 5,924
  • 12
  • 44
  • 69
26
votes
2 answers

round corners with border color

I am using the following code to get rounded corners as well as a colored outline:
Ankush
  • 5,687
  • 8
  • 26
  • 42
25
votes
4 answers

Android circular progress bar with rounded corners

I am trying to get a circular progress bar with rounded corner as shown below. But I am not able to get the rounded corner so far I am able to get the circular progress bar. I am trying to draw it using the xml drawable.
Rakesh
  • 3,507
  • 8
  • 40
  • 63
1
2 3
17 18