views:

1510

answers:

1

Hello,

I would like to create a drawable in XML that should include:

  1. image drawable
  2. color drawable

The color drawable provides white transparent color. So, as a result we would have image with some white transparent layer on top.

I have tried to use LayerDrawable, but it fails to be created during application launch:

<LayerDrawable xmlns:android="http://schemas.android.com/apk/res/android"&gt;
     <BitmapDrawable android:src="@drawable/button_play" />
     <ColorDrawable android:color="#80FFFFFF"/>
</LayerDrawable>

Could you please advice what is wrong here?

Thanks.

+3  A: 

Per the Android documentation for LayerDrawable:

It can be defined in an XML file with the <layer-list> element. Each Drawable in the layer is defined in a nested <item>.

CommonsWare