I saw in the Android documents there is a setAlpha API Level 1.I have a View that I try to use setAlpha(float) on the view, but the compiler says no such method exists. Am I missing something?
Asked
Active
Viewed 4,772 times
2 Answers
3
As far as I can see, http://developer.android.com/reference/android/view/View.html#setAlpha(float) is only supported from API level 11 (not 1).
If you want to use this, you'll have to add to your Manifest something like
<uses-sdk android:minSdkVersion="11"/>

Marc Van Daele
- 2,856
- 1
- 26
- 52
-
uses-sdk wont really address the issue. The calls to setAlpha() will fail in pre-11 devices – Vikram Bodicherla Jan 11 '12 at 07:49
-
It depends on what the issue exactly is: if the OP wants to use setAlpha then he needs to set minSDK to 11. But as you point out correctly, that impacts the devices on which the code will run. – Marc Van Daele Jan 11 '12 at 16:21
-
minSdkVersion is irrelevant, important is target=android-11 in project.properties – Pointer Null Aug 06 '12 at 12:28
0
Set the background of the view to a color using the ARGB scheme.
android:background=#77777777
sets it to a dull translucent gray
This doesn't work in the case of ListView items, which is an exception.

Vikram Bodicherla
- 7,133
- 4
- 28
- 34
-
Bad approach. Certainly for listview item it will mess with list selector. – Pointer Null Aug 06 '12 at 12:29
-
@mice, the ListView is an edge-case, which my answer doesn't cover. I apologize. – Vikram Bodicherla Nov 03 '12 at 14:09