Questions tagged [drawable]

A Drawable is a graphics-related term which generally means "something to be drawn."

While there are multiple definitions of Drawable in the wild, in most cases a Drawable is a general abstraction for "something that can be drawn." GDK provides a different definition: a Drawable is an element onto which things can be drawn.

2977 questions
93
votes
3 answers

BitmapDrawable deprecated alternative

I have the following code that will rotate a drawable by a set amount of degrees. public Drawable rotateDrawable(float angle, Context context) { Bitmap arrowBitmap = BitmapFactory.decodeResource(context.getResources(),…
Lee Armstrong
  • 11,420
  • 15
  • 74
  • 122
91
votes
4 answers

Contact Bubble EditText

I am trying to create contact bubbles in the MultiAutoCompleteTextView similiar to how it is implemented in the Google+ app. Below is a screen shot: . I have tried to extend the DynamicDrawableSpan class in order to get a spannable drawable in the…
Etienne Lawlor
  • 6,817
  • 18
  • 77
  • 89
89
votes
4 answers

What's the correct size icon for drawable-xxhdpi?

As we know, the correct sized icon: * drawable-ldpi (120 dpi, Low density screen) - 36px x 36px * drawable-mdpi (160 dpi, Medium density screen) - 48px x 48px * drawable-hdpi (240 dpi, High density screen) - 72px x 72px * drawable-xhdpi (320 dpi,…
Jerikc XIONG
  • 3,517
  • 5
  • 42
  • 71
88
votes
5 answers

Get the URI of an image stored in drawable

I am adding a couple of sample items in my application so it doesn't look so empty when the user look at it the first time. The list with the sample items should have an image and the image I am going to use is already stored in the…
Roland
  • 5,328
  • 10
  • 37
  • 55
88
votes
7 answers

how to access the drawable resources by name in android

In my application, I need to get the some bitmap drawables somewhere where I do not want to keep the reference R. So I create a class DrawableManager to manage the drawables. public class DrawableManager { private static Context context =…
hguser
  • 35,079
  • 54
  • 159
  • 293
75
votes
8 answers

Shape drawable as background, a line at the bottom

I am using a drawable as a background of a TextView just to have a divider line below the text. A achivied it with this drawable-xml:
ZoolWay
  • 5,411
  • 6
  • 42
  • 76
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
71
votes
5 answers

setBackgroundResource() discards my XML layout attributes

I have a view which is used as an item in a ListView. In my custom adapter, I change the background of the view using View.setBackgroundResource() depending on the item's position in the list. (I have separate assets for the first and last items in…
Graham Borland
  • 60,055
  • 21
  • 138
  • 179
70
votes
5 answers

Android : Rotate Vector Image to 90 degree

I have following code for my vector:
Pratik Butani
  • 60,504
  • 58
  • 273
  • 437
70
votes
12 answers

android animation is not finished in onAnimationEnd

It seems that an android animation is not truly finished when the onAnimationEnd event is fired although animation.hasEnded is set to true. I want my view to change it's background drawable on the end of it's ScaleAnimation which it does, but you…
ShadowMare
  • 2,087
  • 2
  • 25
  • 27
70
votes
3 answers

what does android getIntrinsicHeight and getIntrinsicWidth mean?

Hi I am confused by the two methods from Android Drawable class getIntrinsicHeight() getIntrinsicWidth() api definition says http://developer.android.com/reference/android/graphics/drawable/Drawable.html#getIntrinsicHeight() what does the word…
user1697965
  • 1,255
  • 3
  • 14
  • 22
68
votes
6 answers

Modifying the color of an android drawable

I would like to be able to use the same drawable to represent both: and as the same drawable, and re-color the drawable based on some programmatic values, so that the end user could re-theme the interface. What is the best way to do this? I have…
steve-gregory
  • 7,396
  • 8
  • 39
  • 47
65
votes
4 answers

Android TextView drawable, change padding between drawable and text?

I am creating a TextView with a drawable underneath, in a GridLayout. I want to bring the drawable to the middle of the TextView; I tried with setCompoundDrawablePadding(-75) and it only changes the position of the text. Current code: TextView…
user1648374
  • 655
  • 1
  • 5
  • 8
64
votes
6 answers

Drawable to byte[]

I have an image from the web in an ImageView. It is very small (a favicon) and I'd like to store it in my SQLite database. I can get a Drawable from mImageView.getDrawable() but then I don't know what to do next. I don't fully understand the…
David Shellabarger
  • 1,523
  • 2
  • 15
  • 23
64
votes
3 answers

Drawing multiple shapes with ShapeDrawable in xml with Android

I am currently drawing a number of circles on a canvas in a custom view in code. the circles are static and do not change. I would like to draw them using a ShapeDrawable in xml to help clean up my code. I will have a number of different drawables…
skyfoot
  • 20,629
  • 8
  • 49
  • 71