Change Items By Java Code
I have the following XML:
Solution 1:
Assuming that you want to have access to them through Java code after they are loaded as a Drawable in your app, you should be able to do something like the following:
@OverrideprotectedvoidonCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
finalLayerDrawableld= (LayerDrawable) getResources().getDrawable(R.drawable.my_drawable);
finalClipDrawabled1= (ClipDrawable) ld.findDrawableByLayerId(R.id.customPlayerProgress);
finalClipDrawabled2= (ClipDrawable) ld.findDrawableByLayerId(R.id.customPlayerProgressSecondary);
/* modify ld, d1 and d2 by calling their methods here */
}
Also look at this for some more ideas.
Post a Comment for "Change Items By Java Code"