Thanks Jason! This worked great, except that the clip elements I used
looked like this:
<clip android:drawable="@drawable/myProgressDrawable" />
-Allan
--
Allan Hsu <allan at counterpop dot net>
On Oct 4, 2008, at 10:08 AM, Jason Parekh wrote:
> I believe so, see my inline comments below
>
> On Sat, Oct 4, 2008 at 2:50 AM, Allan Hsu <[EMAIL PROTECTED]>
> wrote:
>
> Jason,
> Is it possible to use 9-patch drawables instead of gradients?
> If it
> is, I can't seem to figure out how to specify it.
>
> -Allan
> --
> Allan Hsu <allan at counterpop dot net>
>
> On Oct 3, 2008, at 11:12 PM, Jason Parekh wrote:
>
> > Hi Allan,
> >
> > Here's an example XML drawable for the horizontal progress bar. You
> > could set the ProgressBar.setProgressDrawable to this.
> >
> > <layer-list xmlns:android="http://schemas.android.com/apk/res/
> > android">
> >
> > <item android:id="@android:id/background">
>
> This one is for the background, and nine patch should be fine here.
>
> Something like this should work:
>
> <item android:id="@android:id/background"
> android:drawable="@drawable/myDrawable" />
>
>
> > <shape>
> > <corners android:radius="5dip" />
> > <gradient
> > android:startColor="#ff9d9e9d"
> > android:centerColor="#ff5a5d5a"
> > android:centerY="0.75"
> > android:endColor="#ff747674"
> > android:angle="270"
> > />
> > </shape>
> > </item>
> >
> > <item android:id="@android:id/secondaryProgress">
> > <clip>
>
> This is for the secondary progress (the regular progress below is
> similar). You should be able to replace this <clip>...</clip> block
> with:
>
> <clip drawable="@drawable/myProgressDrawable" />
>
> Progress is shown on a drawable by calling its setLevel. Since your
> nine-patch will ignore the level and always fill the entire space,
> we need some way of showing the level. This is what the clip does.
> It will clip the nine-patch (horizontally) based on the current
> progress.
>
> jason
>
>
> > <shape>
> > <corners android:radius="5dip" />
> > <gradient
> > android:startColor="#80ffd300"
> > android:centerColor="#80ffb600"
> > android:centerY="0.75"
> > android:endColor="#a0ffcb00"
> > android:angle="270"
> > />
> > </shape>
> > </clip>
> > </item>
> >
> > <item android:id="@android:id/progress">
> > <clip>
> > <shape>
> > <corners android:radius="5dip" />
> > <gradient
> > android:startColor="#ffffd300"
> > android:centerColor="#ffffb600"
> > android:centerY="0.75"
> > android:endColor="#ffffcb00"
> > android:angle="270"
> > />
> > </shape>
> > </clip>
> > </item>
> >
> > </layer-list>
> >
> >
> >
> >
> > And just for future reference, here's an example of the circular
> > indeterminate progress bar XML drawable
> > (ProgressBar.setIndeterminateDrawable):
> >
> > <rotate xmlns:android="http://schemas.android.com/apk/res/android"
> > android:pivotX="50%" android:pivotY="50%"
> > android:fromDegrees="0" android:toDegrees="360">
> >
> > <shape
> > android:shape="ring"
> > android:innerRadiusRatio="3"
> > android:thicknessRatio="8"
> > android:useLevel="false">
> >
> > <size
> > android:width="48dip"
> > android:height="48dip"
> > />
> >
> > <gradient
> > android:type="sweep"
> > android:useLevel="false"
> > android:startColor="#4c737373"
> > android:centerColor="#4c737373"
> > android:centerY="0.50"
> > android:endColor="#ffffd300"
> > />
> >
> > </shape>
> >
> > </rotate>
> >
> >
> > On Fri, Oct 3, 2008 at 6:39 PM, Allan Hsu <[EMAIL PROTECTED]>
> > wrote:
> >
> > Does anybody know the proper format for declaring custom horizontal
> > progressbar drawables in xml? I've searched and searched, but the
> only
> > documentation/discussions I can find are for custom button graphics,
> > which seem to work via a different system.
> >
> > -Allan
> > --
> > Allan Hsu <allan at counterpop dot net>
> >
> >
> >
> >
> >
> > >
>
>
>
>
>
> >
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google
Groups "Android Developers" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to
[EMAIL PROTECTED]
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en
-~----------~----~----~----~------~----~------~--~---