androidandroid-layoutopacitylayer-list

Android: How to specify the opacity of a <layer-list>?


I want my LayerList to have an opacity of 80 so I wrote:

<layer-list
  xmlns:android="http://schemas.android.com/apk/res/android"
  android:opacity="80">

But I get:

Error: Integer types not allowed (at 'opacity' with value '80')

How can I specify the opacity?


Solution

  • android:opacity supports only translucent|opaque|transparent values in layer-list.

    By the way what is your requirement?

    Updated-Answer: To set opacity/less-visible as 80%, you need to set to your view

    android:alpha="0.8"