Questions tagged [xml-drawable]

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

274 questions
72
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
  • 743
  • 1
  • 5
  • 7
62
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
  • 47,260
  • 30
  • 167
  • 264
55
votes
5 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,607
  • 4
  • 21
  • 40
47
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,490
  • 26
  • 97
  • 169
44
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
  • 14,718
  • 15
  • 67
  • 108
41
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,849
  • 3
  • 14
  • 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,823
  • 1
  • 19
  • 25
36
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,420
  • 4
  • 38
  • 58
34
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,994
  • 2
  • 16
  • 26
33
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,530
  • 2
  • 12
  • 23
32
votes
1 answer

Android: how to use the current theme's colors in a drawable xml?

I have defined two themes with different primary, primary dark, primary light and accent colors.