I'm having lots of trouble with the ClipDrawable class, trying to
implement a progress-bar like meter.
I have a bitmap image <meter.png> that I want to crop a dynamic number
of pixels from the left side.
In an xml file called meter_progress.xml (in the res/drawable
directory), I have the following:

<?xml version="1.0" encoding="utf-8"?>
<clip xmlns:android="http://schemas.android.com/apk/res/android";
        android:gravity="left"
        android:clipOrientation="horizontal">

        <bitmap android:src="@drawable/meter"/>

</clip>

I've set this drawable as the source for an ImageView with id
R.id.meter like so:

ImageView view = (ImageView) findViewById(R.id.meter);
Drawable drawable = getResources().getDrawable
(R.drawable.meter_progress);
view.setImageDrawable(drawable);
drawable.setLevel(10);

However, when I test the application, nothing appears. It is almost as
if the entire image has been clipped. I've tried the above code with
and without the call to setLevel, but no difference. Can a bitmap
image be the child of a ClipDrawable? I've not seen a good example
about how to make this work. Do I have to set the width of my
ImageView to wrap_content, or to a fixed number? A bug?

--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google
Groups "Android Developers" group.
To post to this group, send email to android-developers@googlegroups.com
To unsubscribe from this group, send email to
android-developers-unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to