drawable

Custom OverlayItem not drawing.

I created a custom OverlayItem class so that I could essentially have one kind of OverlayItem whose Drawable marker would set itself depending on the state of some data that I pass into it. I have attempted to accomplish this by, on my first attempt, utilizing the setMarker method within the OverlayItem class. Once that did not work I ...

multiple drawables from one xml file

I want to use a number of ShapeDrawables in my application, which are all similar, but with different colours etc. Obviously I could just define them all in separate xml files, but is there a more efficient way to have one xml definition, instantiate various objects and change the colour either in code or xml? You could perhaps do this b...

[android] Why would only 50% of my drawables be drawn?

I have tried to create a simple application that draws a png graphic where the screen is touched. The problem that I have is that only every other instance of the graphic I add is actually rendered. Each time I add a new instance, the pattern alternates. I always get only 50% of the graphics rendered. I am using android level 3 on HTC H...

Android: Overriding the scrollbar drawable in an application

Hi, Is there a way to replace the scrollbar drawable in an application (i.e. I have a customized scrollbar view that I would like to use instead of the default gray scrollbar that comes with the Android framework). I looked through I believe all of the android attributes and none seem to support it (at least the simplest way I know how...

Canvas.DrawCircle VS ShapeDrawable.setBounds()

Hello What is a more efficient methods for drawing circles on a canvas. I can do it two ways: 1) Use canvas.drawcircle(...) 2) ShapeDrawable.SetBounds() followed by ShapeDrawable.draw(canvas) what renders faster? What's better practice? Or does it not matter? ...

Android: gradient drawable as relative layout background

Every time I try to create a gradient drawable as the background my application force closes. Is there anything more I need to do than create the xml files in drawable-hdpi, drawable-mdpi, and drawable-ldpi. and then use android:background attribute to point to them? Are there any examples of this? ...

Avoiding duplicate resources in android project

I have some images in my drawable folder and they have landscape versions in drawable-land. However I want some of the landscape images to be shared, as it seems a waste to duplicate the file with a different name. Is it possible to make a sym link (shortcut) or something for one of the duplicated files to prevent wasting space Folder e...

Need to resize Android ImageView to match changing Drawable size

I would like to be able to alter the size of some of my ImageViews based on what Drawable they are showing. I've not yet decided on whether I'll get them to read the new dimensions from the Drawable or if I will just have an array/enum storing the heights of these, but what I need help with is the actual changing of the ImageView size. ...

Android Development Missing "drawable" folder (NetBeans IDE)

Hello, I recently switched to Ubuntu and decided to use NetBeans for Java development instead of Eclipse which I used on Windows. The problem is, in the Eclipse I used on Windows, I had a folder named "drawable-hdpi" with the standard app icon in and a few other folders like "drawable-mdpi" (I think). But with NetBeans, there doesn't ...

Changing drawableBottom with java

Is it possible to change a drawable on a button via java? Example; I have a button like this. <Button style="@style/Buttons" android:id="@+id/butFavTeam" android:drawableBottom="@drawable/venue"/> I want to change the current drawableBottom image with another from my drawable directory. ...

Is it possible to somehow "bind' the dimensions of a ShapeDrawable to that of a View?

Specifically, I'd like to bind the height of a custom thumb for a SeekBar to the height of the SeekBar. Thanks! ...

Offset shape within a ShapeDrawable

I'm trying to draw a rounded rectangle with a border around it using a class that extends ShapeDrawable (see here) and everything is working except that the shapedrawable seems to be cutting off some of the border because the shape itself doesn't extend outside those bounds. Is there not some way to offset where the shapedrawable start...

Avoiding highlight flash in Android

I have two drawables that are used as backgrounds to indicate state (pressed or selected) of my list items. The Pressed drawable is a selector, but with no state specified; it is wired up via XML to be the android:listSelector for the list. <?xml version="1.0" encoding="utf-8"?> <selector xmlns:android="http://schemas.android.com/a...

Android: Not more than 1 nine patch image at a time?!

Hi, I am having problems with nine patch images ( **.9.png ). I have a widget layout and would like to use nine patch images for the widget's backgroud. Here is my background.xml <selector xmlns:android="http://schemas.android.com/apk/res/android"&gt; <item android:state_focused="true" android:state_pressed="true" android:drawable=...

Does Android encourage reusing their Menu-Icons? Where to get them all?

They do not write anything about licenses at http://developer.android.com/guide/practices/ui_guidelines/icon_design.html#menuapx (Menu Icons) I guess they want to have standard icons look the same in all apps, so users dont get confused. Right? Now I would love to use the Menu-Icon "see map" (a folded map) from the Google Places App. W...

Difference between defining a value in color and drawable tag ?

<resources> <drawable name="red">#7f00</drawable> .... <color name="solid_red">#f00</color> ..... </resources> This is some part of the colors.xml from android samples directory. Now my question is that, what is the difference between defining a color in <drawable> tag and <color> tag ? ...

Where is the drawable for the handle of a SlidingDrawer defined?

I want to use a SlidingDrawer in an activity, and I would love to just use the built-in tray handle, rather than try to find or create my own. I found it online thanks to CommonsWare but I assume that they got it from the Android platform itself, so I figure it will benefit me in the long run to know where to find it, rather than just us...

Should I use Bitmap or Drawable to store in ImageCache on Android?

I implemented a ImageCache. But I'm curious about what type to store in it will cost less. Now I use BitmapFactory to get the images from the internet, so I get a Bitmap first. Should I convert to a Drawable to store in my ImageCache or just store the Bitmap is fine? Any ideas? Thanks. ...

Find out if resource is used

I am looking for an efficient way to find out if a resource (mostly a drawable) is used in java or in an XML file. The problem is, that on my current project the drawables are changed often and now I have some drawables, which might never be used. Is there a tool/way to find those unused drawables without search each filename in the wh...

Gradient drawn on Canvas looks banded

I have a gray gradient drawable (png image in res/drawable). If I draw it on a white Canvas it looks banded (not smooth). If I put the gradient on white background in GIMP, and then draw this drawable on the Canvas, it looks great. What's the problem? I tested this on Nexus One. Calling setDither(true) on the drawable has no noticable ef...