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); Meanwhile, the xml for the drawable is this: <layer-list xmlns:android="http://schemas.android.com/apk/res/android" > <item> <shape android:shape="rectangle" > <solid android:color="#ff999999" /> </shape> </item> <item android:id="@id/custom_layer_id" android:drawable="@drawable/test_gradient"/> </layer-list> Can I set bounds for an individual layer without affecting the other layers? If not, what can I do to get around this issue? -- 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
<<attachment: layer_problem.png>>

