drawable

How to get more control over gradients

I have the following drawable: <?xml version="1.0" encoding="utf-8"?> <shape xmlns:android="http://schemas.android.com/apk/res/android"&gt; <gradient android:startColor="#2F2F2F" android:endColor="#5A5A5A" android:angle="90" android:dither="true" /> </shape> Is there anyway to start the start...

how to create an custom android maps marker?

I want to create a mapview marker with 4 elements: - picture (of user) - background - text (username) - Arrow to show an direction OverlayItem.setMarker() accept only a drawable. How can I create an drawable with 4 Items? Or can i add an View as marker to overlayItem? any ideas? ...

Drawable Rotating around its center Android

I am getting strange results with the following code: iv = (ImageView) findViewById(R.id.iv); iv.setImageResource(R.drawable.spinner_white_76); Animation a = new RotateAnimation(0.0f, 360.0f, Animation.RELATIVE_TO_SELF, iv.getDrawable() .getIntrinsicWidth() / 2, Animation.RELATIVE...

How to set a PNG file to an ImageView?

I have a file called nochart.png in /drawable. How can I set this to an ImageView? chartImageView.setImageDrawable(R.drawable.nochart); Does not compile. ...

Strange drawing artefact using custom drawable with MapView

I'm trying to add my own drawable and use it in a series of overlays on a MapView. The drawable is basically a rounded box with a black outline and a number in the middle. I have managed to achieve this using the code below, however there is what looks like a flag to the left of my box, which I certainly don't think I have drawn - so I...

Android GLSurfaceView with drawable background

I have a GLSurfaceView with a drawable as background, however only the background is visible when rendered without surfaceView.setZOrderOnTop(true) I need to avoid using setZOrderOnTop(true) because there are static TextView's being used on top of the GLSurfaceView. Any suggestions for getting this to work? ...

ViewFlipper FLICKERING problem?

I have a ViewFlipper with two ImageView widgets. I have set the in and out animation as android.R.anim.slide_in_left and android.R.anim.slide_out_right Now when the two ImageViews have two different drawables, then the animation is sleek and smooth. But when I set the both the ImageViews to the same Drawable, the screen flickers. Why is...

Gallery/AdapterView Child Drawable State

I am using a Gallery view where the view corresponding to each item is non-trivial and consists of text as well as multiple buttons. When I click to drag the gallery view (somewhere not on one of the buttons) the button's drawable state changes to pressed and appears as if all of the buttons are currently being pressed. Additionally, th...

Twitter-Like background animated drawable in android

Just like Twitter for android used to have (they removed it) - I need to display an animated background drawable. How to I show an image that is actually bigger then the given layout dimensions (without the image being shrink). What kind of animation do I need to use for the "moving" effect? thanks. ...

How to create nine patch png image in android ?

Hi , I have an image with a fixed size , ex. 300 x 300 ; it was a background image of my view. But my view size was dynamic , so i need an image which can stretch , according to desired size. can any one tell me how to make it ? I know we have to use nine oatch drawable ? i dont know how to tool given with android sdk ? can any one te...

How are PNG files defined as drawable objects resized based on the resolution of the Android phone?

I have a PNG file that is 32x32 pixels. I use 8 of these as drawables in a row for my app. These drawables are not in the hdpi, mdpi, or ldpi folders. I’ve found that when starting any of the 3 standard size emulators, the screen view with all 8 drawables looks pretty much the same. I note that the ldpi emulator I’m using (QVGA) has ...

how drawables resources stored on device

guys, I wonder if you put images for each density type (low/medium/high) and there are quite a few of them, won't it increase the size of application footprint on internal memory? I would hope that android will put only needed resource file from apk to the actual application folder. Can somebody confirm that? ...

android, drawable resource loaded to memory?

does all resource (all in res folder if on eclipse IDE), specially drawable image, is loaded to memory during runtime? or it is just like a file which is available when the application need it? ...

How to add XML drawable in Eclipse

Ok guys I'm little stacked here. According to official documentation Google says that "Once you've defined your Drawable in XML, save the file in the res/drawable/ directory of your project." is the way to add a XML drawable to the project. But when I created the project ADT created 3 different drawable folders for mdpi, hdpi, and ldpi....

How to put text in a drawable?

I'm trying to create a drawable on the fly to use as a background for a custom linearlayout. It needs to have hash marks and such (no big deal), but also have numbers labeling what the hash marks are (like a ruler). I know I can just create text elements and put them inside the linearlayout and just have the hash marks in the drawable, b...

In an Android state-list drawable, state_focused is ignored

My Android app, which uses a TabActivity to display its contents, has 4 tabs which all use a state-list drawable for the icon. They all have the same structure, just with different images: <?xml version="1.0" encoding="utf-8"?> <selector xmlns:android="http://schemas.android.com/apk/res/android"&gt; <item android:drawable="@...

Performance wise, what is typically better, using an image or a xml created shape as a drawable?

For example, if each row in a list had a background that was a gradient, would it be better to use a image of a gradient or to define that gradient in a shape drawable in xml? Is there is significant performance difference between the two methods? ...

Is it possible to create a custom state for use in a StateListDrawable?

They have states for things like pressed, focused, disabled, but is it possible to create custom states so it could reflect some of my own custom criteria? For example, say you have a list of names. Some people fall into a certain category that should be visually represented differently. These people's rows would then have a different ...

Loop one layer in a LayerDrawable ?

Hi, I'm trying to loop 1 layer which is in the middle of a stack of semi transparent png images. The initial layerDrawable is created in XML, then the LayerDrawable is retrieved using findViewById().getDrawable(). I can change one of the layers using LayerDrawable.setDrawableByLayerId() if the command is in the same method. But when ...

Android Layer_Drawable as a button.

I have a button. The button is constructed from the StateListDrawable (made of 3 9-patch images). I need to add an extra drawable that will reside on the button's right side, and i need it to be aligned with the button's right side. I tried to use the following: <?xml version="1.0" encoding="utf-8"?> <layer-list xmlns:android="http://sc...