Bex Bex - 4 months ago 16
Android Question

Setting Alpha level on view doesn't work

I am trying to set the alpha level of a view.
I am reading the documentation here:

http://developer.android.com/reference/android/widget/RelativeLayout.html

and it seems as if it should be possible even on android 2.1 which I am developing for (as I cant see it saying otherwise) but when I add it to my view

<View
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:layout_margin="20sp"
android:background="#ffffff"
android:alpha="0.9"></View>


I get an error saying:


No resource identifier found for attribute 'alpha' in package
'android'


How do I set the alpha level of a view?

Answer

you can set the alpha with the background properties like this way

android:background="#50ffffff"

here the first 50 value is set the alpha value