drawable

@Android display /res/viewable in WebView

I am throwing HTML to a webview to render. In the HTML I need to load an image that I have in /res/drawable. I have /res/drawable/my_image.png and code such as this: final WebView browser = (WebView) findViewById(R.id.my_webview); String html = new MyHelper(myObject).getHtml(); browser.loadDataWithBaseURL("", html, "text/html", "UTF-8"...

clarification on 'private' drawables in android.R.drawable

I am making a menu for an app and was pointed to this useful resource which lists all the drawables that are part of the android 2.0 jar. the usage example given is myMenuItem.setIcon(android.R.drawable.ic_menu_save); Unfortunately, the one I want (and most of the list) are not available by default. I get android.R.drawable.ic_menu_...

Android vertical line xml

Hello, I'm trying to figure out how to define a verical line (1px thick) to be used as a drawable. to make a horizontal one, it's pretty straightforward: <shape xmlns:android="http://schemas.android.com/apk/res/android" android:shape="line"> <stroke android:width="1dp" android:color="#0000FF"/> <size android:height="50dp" /> ...

How can I set drawable to a ListView in android

I am writing a app for android 1.5. I want to use a complex listview to display my data. I want to show a ImageView of a drawable object in my List item. I learned from a demo: ------> listData.put("Img", listData.put("Img", R.drawable.XXX)); listData.put("Time", "100"); listItems.add(listData); It can displ...

Adding multiple images to AnimateDrawables sample code in Android

Hello, I was trying to add more than one images in the AnimateDrawables under com.example.android.apis.graphics, but for some reason I couldn't. Can anyone post a sample code on how to accomplish it or at least explain it to me? This beginner programmer would really appreciate it. Thanks ...

How can I create a drawable which changes depends on state AND also overlay a image?

Hi, I have a TextView which has a drawable changes depends on state: <TextView android:background="@drawable/textbackground"...> And my textbackground.xml is <selector> <item android:state_focused="true" android:drawable="@drawable/highlightborder" /> </selector> And highlightborder.xml is <shape xmlns:android="http://schemas.a...

Drawable from mdpi loading instead of hdpi

Hi, I have set up my project with different drawable directories (ldpi, mdpi and hdpi). I have a background png with two different resolutions: 320x480 in drawable-mdpi folder, and 480x800 in drawable-hdpi. Both have the same filename. When I try to load the background as a style in the manifest (using android:windowBackground in the sty...

Android: Where to find the RadioButton Drawable?

Ok, I am trying to create a custom view called CheckedRelativeLayout. It's purpose is the same as a CheckedTextView, to be able to use it in a list of items you want selected or in a Spinner. It's all working fine now, I extended RelativeLayout and implemented Checkable interface. However, I am stuck on a quite simple problem: Where c...

How to get a byte array from a drawable ressource ?

Hi all, I would like to get a byte array from an jpeg image located in my res/drawable file ? Does anyone know how to do that please ? ...

Apply an Animation on a Drawable in Android

I am adding a glow animation effect to a logo. So far, I have managed to get the glow image behind the logo, using a LayeredDrawable, but I can't figure out how to animate it. I have found that AlphaAnimation would achieve the desired effect, but unfortunately I can only apply it on Views, not Drawables. How can I achieve this effect? ...

Android: access drawables outside an activity

How do access a drawable which resides in my project's res/drawable folder from outside an activity? The component which handles the loading of images is generic and is not inside any activity. I would like to display an image from res/drawable in case it can't be fetched from the web. Thanks, Rob ...

How to draw a Drawable over a View

I have several Views in my Activity. I want to draw a Drawable over these views. The Drawable should be on top of the views (that means it hides the views below it. The Drawable may appear over several views (that is I can't just draw it in one view). How can this be done? Thank you ...

ListActivity adding images!?

Hi Guys, i have a following ListActivity: public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); // Get Strings from res/strings.xml String items[] = { getString(R.string.mainMenu_1), getString(R.string.mainMenu_2), getString(R.string.mainMenu_3), getString(R.string.mai...

How do I create an ImageView in java code, within an existing Layout?

I'm looking for an easy way for the user to see how many drinks they've had for a BAC calculator. PICTURE OF THE APP, for reference On button press, I would like an image to be added to the screen, directly under the spinner and with left alignment. When I press the button again, I want another image to be added to the screen. So if I...

Android: how to convert a Drawable to Bitmap

How can I convert a Drawable to a Bitmap? I would like to set a certain drawable as the device's wallpaper, but all wallpaper functions accept Bitmaps only (I cannot use WallpaperManager - I'm pre 2.1). Also, my drawables are downloaded from the web and do not reside in R.drawable. Thanks, Rob ...

Android ImageView with drawable not always rendering

I have an ImageView object that I'm setting the android:src="@drawable/some_xml_file" instead of a standard png and it seems to not always render the drawable, as you can see in the first row here (it also happens intermittently in other rows as well): I've tried setting the src & the background property but they both have the same effe...

Android multiple stroke box in drawable xml

I'm trying to achieve what amounts to effectively 2 strokes on a rectangle in a <shape> element in an android drawable xml. A dark green outer line and a light green inner line, with a gradient fill in the center of it all. My code currently looks like this: <layer-list xmlns:android="http://schemas.android.com/apk/res/android"&gt; ...

Android ImageButton - determine what resource is currently set

Is there a way I can find what resource a particular ImageButton is set to, at any given time? For eg: I have an ImageButton that I set to R.drawable.btn_on onCreate. Later, at some point, the ImageButton gets set to R.drawable.btn_off. I want to be able to check what resource the ImageButton is set to in my code. Thanks Chris ...

Select Drawable file path

I am developing an android application that receives data about events from a server. In a ListView I put the name and category of the event and a picture. My problem is: each category should have a specific picture. How do I choose which of the pictures in the drawable folder should be displayed? View v; /**I get this view from the pa...

Android: Draw custom border around listview?

Hi, I've got a ListActivity with a ListView in it. I need to draw a repeating image around the border ("on top of it (I guess after the listview is renderered)) How can I hook in my own drawing code for this? ...