Reputation: 9736
I would like a LinearLayout translucent (I don't mean transparent). I want to emulate a Dialog in my Activity. So I tried this:
In Manifest:
android:theme="@android:style/Theme.Translucent"
In Activity onCreate:
LinearLayout MyLayout = (LinearLayout)findViewById(R.id.MyLayout);
MyLayout.setBackgroundColor(Color.BLACK);
MyLayout.getBackground().setAlpha(50);
But it doesn't work because I don't see the Home Desktop at all. Any idea?
I also tried this in xml but it din't work either:
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:id="@+id/MyLayout"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="#22FFFFFF"
android:orientation="vertical" >
</LinearLayout>
Upvotes: 3
Views: 5223
Reputation: 37729
Use an hexadecimal color code, wich consists of two digits for alpha and six for the color itself, like this:
android:background="#22FFFFFF"
It'll make it semi-transparent.
Upvotes: 2