In Android, a Drawable is a general abstraction for "something that can be drawn."
Questions tagged [android-drawable]
2993 questions
1
vote
2 answers
working with assets folder or drawable folder
I am creating an app using android studio.
i created the assets folder and created sub directories under it for each activity i am using (each one has a different set of images).
But on the other hand i want to support multiply screen resolutions…

IB.
- 1,019
- 3
- 13
- 21
1
vote
2 answers
Vector XML element not recognized in Android Studio
I have started development on Android 5.0. I'm reading about the vector drawables in the documentation: http://developer.android.com/training/material/drawables.html.
When I add a vector drawable to my res/drawable folder, I get the message:
I'm…

Peter
- 10,910
- 3
- 35
- 68
1
vote
0 answers
How to set size of nine-patch drawable programmatically in android
This is how we can resize a normal bitmap drawable
Drawable d = getResources().getDrawable(R.drawable.error);
Bitmap bm = ((BitmapDrawable)d).getBitmap();
error_indicator = new BitmapDrawable(getResources(), bm.createScaledBitmap(bm, 50,…

sanedroid
- 1,036
- 4
- 16
- 27
1
vote
1 answer
Android: How to create a dynamically changing image still looking good?
I wonder how to do something like Whatsapp or Telegram does in their messageboxes.
They always look good no matter how big they get, related to the text you send.
I tried to do this myself, i made this picture:
Now i use this in my App: (it is…

progNewbie
- 4,362
- 9
- 48
- 107
1
vote
1 answer
Track on screen rendering
I m trying to track after the screen rendering in Android for move a simple Object on screen but with no luck.
For Example: The background and the bars in flappy bird game, How does they "move" and the bird is flying like?!
I m trying to avoid from…

gran33
- 12,421
- 9
- 48
- 76
1
vote
1 answer
set size of image resource on the fly with call setImageResource
I have a drawable that I would like to render in different sizes on the fly, as opposed to setting the size in layout file. How might I do that? I am referring to the call
imageView.setImageResource(R.drawable.image);

Katedral Pillon
- 14,534
- 25
- 99
- 199
1
vote
1 answer
How to obtain a Drawable (with drawable alias) using TypedArray
So, according to the Android documentation, Resources.getDrawable() has a known bug for OS versions before Jelly Bean, where aliased drawables would not be resolved with the correct density (so a 100px image in drawable-hdpi gets upscaled to 150px…

Kevin Coppock
- 133,643
- 45
- 263
- 274
1
vote
3 answers
ImageView vs Images
fromI am using ImageView in my App,Like below code
ImageView menu=(ImageView)findViewById(R.id.imageView1);
@Override
public void onclick(View v)
{
int id = v.getId();
if(id==R.id.imageView1)
{
if (menuopen.getVisibility() ==…

learner
- 3,092
- 2
- 21
- 33
1
vote
2 answers
android: How check image drawable?
Hi I'm using this code for checking current image:
public void onToggle(View view){
ImageView imageFav = (ImageView) view;
if (imageFav.getResources().equals(R.drawable.fave_icon_1)) {
dataSource.addToFavorite(idiom);
…

Sirwan Afifi
- 10,654
- 14
- 63
- 110
1
vote
1 answer
How to initialize an Integer array with R.drawables (Images) using for loop or directory in Android?
I have this array of drawables:
Integer[] mThumbIds = { R.drawable.celeb_0, R.drawable.celeb_1,
R.drawable.celeb_2, R.drawable.celeb_3, R.drawable.celeb_4,
R.drawable.celeb_5, R.drawable.celeb_6, R.drawable.celeb_7,
…

Waqleh
- 9,741
- 8
- 65
- 103
1
vote
2 answers
How to check from Robotium that my png is present on the screen?
I create an additional method:
public boolean exampleEdTxt1(){
try{
solo.getCurrentActivity().getResources().getDrawable(R.drawable.action_drw);
return true;
}
catch(AssertionError e){
return false;
}
}
But, when test is runing,…

Игорь Кожин
- 41
- 6
1
vote
2 answers
AnimationDrawable with setImageResource for no stretched image?
I have rocket_thrust.xml in res/drawable/:
-

Johnny
- 612
- 3
- 13
- 32
1
vote
1 answer
Android drawing multiple different size bitmaps to same size canvas
I have some different size bitmap here:
and I want to resize them to same width and height (64px) each image
here is what I did:
int size = Math.round(64 * getResources().getDisplayMetrics().density);
int imagesLength = 4;
Bitmap bmp =…

user3896501
- 2,987
- 1
- 22
- 25
1
vote
1 answer
Drawables not scaling for missing density buckets, if using drawable references
First, some background on what I'm doing. If you are familiar with references in general (simple concept), just skip to section 2, please.
1 The concept of density references
Usually, we use drawables in folders such as drawable-mdpi, drawable-hdpi…

davidcesarino
- 16,160
- 16
- 68
- 109
1
vote
2 answers
Turn an ArrayList of filenames to Android resources
I have in my database a column that stores the filename of the images I'm using in the android application. In most of my activities I need to use a lot of these images.
So I store these filenames in an ArrayListand I want for my output to…

tvieira
- 1,865
- 3
- 28
- 45