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

Nicolas Raoul picture Nicolas Raoul · Jan 28, 2013 · Viewed 7.8k times · Source

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?

Answer

Jagadeesh picture Jagadeesh · Jan 28, 2013

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"