Skip to content Skip to sidebar Skip to footer

Transparent Activity, With A Faint Tint Of Grey

I am trying to have a transparent Activity, with a faint grey Color tint, over another activity. I am able to invoke the transparent activity, but I am not able to get the Greyish

Solution 1:

I don't think it's a good idea to put activities on top of each other. If you want to show something on top of your normal activity, then using a FrameLayout is a posible solution:

<FrameLayoutxmlns:android="http://schemas.android.com/apk/res/android"android:layout_width="match_parent"android:layout_height="match_parent"android:id="@+id/main_layout" ><LinearLayoutandroid:layout_width="match_parent"android:layout_height="match_parent"android:background="#ffffffff"android:id="@+id/underlying_layout" ><!--Put the parts of your normal activity here --></LinearLayout><LinearLayoutandroid:layout_width="match_parent"android:layout_height="match_parent"android:background="#88666666"android:id="@+id/top_layout"><!--Put the parts of the layout here, 
        what should be on top of your activity--></LinearLayout></FrameLayout>

Now if you want to make the top level stuff appear or disappear, then you can use the Views setVisibility() function like this:

View topLevelLayout = findViewById(R.id.top_layout);

//make it disappear with all its sub-ViewstopLevelLayout.setVisibility(View.INVISIBLE);

//make it appear with all its sub-ViewstopLevelLayout.setVisibility(View.VISIBLE);

UPDATE

enter image description here

Solution 2:

I believe the problem lies within the value of the color itself.

#FFFECA11

The reason being that the color is broken down into four values, #AARRGGBB. The first two are the transparent values, and by using FF in your first two values, you are ensuring that it is not transparent. Try using the following value to get around 50% transparency:

#7FFECA11

For more information, see the following link: http://developer.android.com/guide/topics/resources/more-resources.html#Color

Post a Comment for "Transparent Activity, With A Faint Tint Of Grey"