How to create transparent activity in android?

Narasimha picture Narasimha · May 2, 2013 · Viewed 30.3k times · Source

How to create transparent activity in android in that screen tap to dismiss button automatically dismiss the activity. please provide any solution.

enter image description here

Answer

Rachita Nanda picture Rachita Nanda · May 2, 2013

There are two ways to achieve this

  • use the following theme for activity.

android:theme="@android:style/Theme.Translucent"

  • Set background of the activity as a trans parent png image or a transparent code

eg.

android:background="@drawable/transparent_bg"

or

android:background="#33BBFFFF"

this is a semi transparent color

Related Links

How to make a background 20% transparent on Android

Understanding colors on Android (six characters)

  • To dismiss activity on tap implement onTouchListener and when touch event is detected call finish();

Hope it helps !!