In Android, a Drawable is a general abstraction for "something that can be drawn."
Questions tagged [android-drawable]
2993 questions
1
vote
0 answers
Code to take images from specific drawable folder
How can I code the app such that if the device is 7inch tablet it should take images from drawable-xhdpi? I could of course create folder drawable-sw600dp-hdpi and put my xhdpi images there but the app limit is 50MB, so I need to figure it out.

Nazerke
- 2,098
- 7
- 37
- 57
1
vote
2 answers
add drawable image To Button
I want to insert images into dynamic buttons, I can get everything other than images. I want my button to display as text+image, but instead I am getting text + androidgraphics.drawable.bitmapdrawable@416e5 etc. Can anyone tell what the mistake is…

ammu
- 117
- 2
- 14
1
vote
0 answers
Images loaded from expansion file appears smaller than it should look
I'm developing an app with many images. Some of the images I moved to expansion files, because of the app limit(50MB). Before I put all my images into different folders like drawable-xhdpi, drawable-mdpi, etc. Now I'm programmatically determining…

Nazerke
- 2,098
- 7
- 37
- 57
1
vote
1 answer
Is possible to make an animation with the android native ProgressBar image and use as a drawable?
I'm using Universal Image Loader to load a previous image before the official one in my catalog.
But as a request from my boss, I have to insert a native ProgressBar before the loading of all official images in the app.
Universal Image Loader…

Leonardo Leonardo
- 452
- 4
- 20
1
vote
0 answers
Problems When Changing Visibility and Background of a View
I have a LinearLayout in which a TextView's visibility and background (GradientDrawable) changes according to a function myFunction():

user1987392
- 3,921
- 4
- 34
- 59
1
vote
2 answers
How do I get background resource to fill LinearLayout
Here is my layout

learner
- 11,490
- 26
- 97
- 169
1
vote
1 answer
Programatically changing the background of an ExpandableListView's group during onResume in Android
I've been having some trouble with onPause and onResume when implementing an ExpandableListView in my app. I may be doing this all wrong (in which case please tell me and I will endeavor to do it correctly) as I'm learning Android mainly from what I…

T_Bacon
- 404
- 6
- 22
1
vote
1 answer
Android - Adding shadow to imageview
I was following the accepted answer of this question: Custom ImageView with drop shadow to add a shadow to my simple app's image view. I am reusing the exact the same drawable 9-patch image from the answer, and here is my code:

Allan Jiang
- 11,063
- 27
- 104
- 165
1
vote
4 answers
get onclick events on drawable of textView using setCompoundDrawablesWithIntrinsicBounds(left, top, right, bottom)
I just wanted to know that can we get two different onclick event on setCompoundDrawablesWithIntrinsicBounds(left, top, right, bottom) on textview.
first onclick on textview and other on drawable or can i get onclick on just drawable not the…

gb17
- 43
- 1
- 9
1
vote
1 answer
android - How to draw multi color line with only a shape
I need to draw a line using android drawable, but this line need to has more than one color, and it cant be gradient. My target is as below:
Note the line with green, blue and orange colors.
I´ve read here a post that mentions that it could be done…

andresmafra
- 491
- 7
- 19
1
vote
3 answers
ImageView with background states crashes after multiple orientation changes
I have an ImageView with a custom background which is basically with two states, normal and pressed (and images for each). The imageview, with the background is defined in xml. Normally, everything works fine, but after a significant amount(20+) of…

Soham
- 4,940
- 3
- 31
- 48
1
vote
1 answer
How does Android fetch a drawables if there isn't a matching drawable in res?
I'm wondering how Android fetches and renders drawables if there isn't an accurately-scaled drawable in a relevant folder?
For example, let's say that I'm trying to render a drawable on a device that is hdpi, large, and running Android 2.3. The…

Phazor
- 1,032
- 1
- 9
- 15
1
vote
5 answers
setImageDrawable is not setting the current drawable
After reading dozens of Q&A regarding the subject, I couldn't find an answer to this situation.
In my app, the user is dragging different icons from one table layout to another (the bottom table layout is sort of an "icon keyboard").
After dragging…

Maoritzio
- 387
- 1
- 6
- 8
1
vote
0 answers
PagerTabStripe and Icon centering
I have a little problem with my PageTabStripe. The text is not centered as well as the image is.
Here you can see a image of the problem:
This is how I add the images:
@Override
public CharSequence getPageTitle(int position) {
…

Maximus1809
- 575
- 1
- 10
- 30