Think I've got it, even without the 9-patch hack. Using <scale> to translate/move a separate <bitmap> with gravity to prevent scaling the needle itself. Sure at low "progress" it will be clipped, as the 9-patch would be "squashed". But that's easy to compensated for.
On Jan 5, 3:57 am, Henrik Lindqvist <henrik.lindqv...@gmail.com> wrote: > Thanks for the tips. Seems ProgressBar is useless in this case, so > I'll probably need to "hack" my own. > > The ApiDemos contains a resource for circular progress-bars, \samples > \android-8\ApiDemos\rescircular_progress.xml: > > <layer-list xmlns:android="http://schemas.android.com/apk/res/ > android"> > <item android:drawable="@drawable/progress_circular_background" /> > <item> > <rotate > android:pivotX="50%" > android:pivotY="50%" > android:fromDegrees="0" > android:toDegrees="360" > android:drawable="@drawable/progress_particle" /> > </item> > </layer-list> > > So <rotate> is supported. Too bad <translate> isn't. > > On Jan 5, 3:39 am, Mark Murphy <mmur...@commonsware.com> wrote: > > > AFAIK, neither <rotate> nor <translate> are valid for a drawable > > resource. Those are used with tween animations for animation > > resources: > > >http://developer.android.com/guide/topics/resources/animation-resourc... > > > As for how to solve your problem, one solution put an ImageView with > > your needle atop your ProgressBar and use margins to position it. > > Crude, but as you point out, in app widgets, you don't exactly have > > tons o' options. > > > Another possible solution is to make your progress drawable be a > > nine-patch PNG, where the needle is outside of the stretch area. That > > may not give you quite accurate results for low progress values, but > > it will asymptotically approach accuracy by the time you complete the > > bar. > > > On Tue, Jan 4, 2011 at 9:30 PM, Henrik Lindqvist > > > <henrik.lindqv...@gmail.com> wrote: > > > I'am trying to make a ProgressBar with a moving needle. Since it's in > > > a app-widget I can't make any custom code. It all needs to be done > > > with Drawables. > > > > Creating a rotating ProgressBar is easy, just use <rotate>. But to > > > move a needle image I've tried <translate>, it gives an error "invalid > > > drawable tag translate". > > > > Anyone got any suggestions? > > > > -- > > > 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 > > > -- > > Mark Murphy (a Commons > > Guy)http://commonsware.com|http://github.com/commonsguyhttp://commonsware.com/blog|http://twitter.com/commonsguy > > > Android Training in London:http://bit.ly/smand1andhttp://bit.ly/smand2 -- 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