Reputation: 199
Given a drawable like so:
<layer-list xmlns:android="http://schemas.android.com/apk/res/android">
<item>
<shape android:shape="rectangle">
<solid android:color="#FF0000"/>
</shape>
</item>
<item>
<nine-patch android:src="@drawable/button_down_red" />
</item>
</layer-list>
I would like to create an animator to animate the solid color, but I can't seem to find a way to access a property within the layer-list.
Upvotes: 1
Views: 2501
Reputation: 199
I figured out how to do this:
ImageView iv = (ImageView) findViewById(<id of the layer-list drawable>);
LayerDrawable layer = (LayerDrawable) iv.getDrawable();
GradientDrawable border = (GradientDrawable) layer.getDrawable(0);
Upvotes: 2