W dniu poniedziałek, 30 lipca 2012 18:44:34 UTC+2 użytkownik Jonathan Koren
napisał:
>
> I'm creating a custom View that looks like a horizontal ProgressBar but
> doesn't always have to touch the left edge. My approach is to use a
> LayerDrawable in which one layer uses different bounds (computed at run
> time). The attachement shows expected (top) versus actual (bottom) results.
>
> From what I can tell, setting the bounds for one layer also sets the
> bounds for the entire LayerDrawable. The code in the custom View is
> essentially this:
>
> int left, top, right, bottom;
> /*... do some math ... */
> Drawable d = mDrawable.findDrawableByLayerId(R.id.custom_layer_id);
> d.setBounds(left, top, right, bottom);
>
>
> Can I set bounds for an individual layer without affecting the other
> layers? If not, what can I do to get around this issue?
>
as far i know this is not true: you can change the bounds of one layer
without affecting the other layers. try to:
d.setBounds(left, top, right, bottom);
d.invalidateSelf();
in some callback method e.g. onClick(View v) and you will see it works as
expected
pskink
--
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