You can do a transparent activity using this style:
<style name="TransparentActivity" parent="android:Theme.Black.NoTitleBar.Fullscreen"> <item name="android:windowBackground">@android:color/transparent</item> <item name="android:colorBackgroundCacheHint">@null</item> <item name="android:windowIsTranslucent">true</item> <item name="android:windowAnimationStyle">@android:style/Animation</item> <item name="android:windowNoTitle">true</item> <item name="android:windowContentOverlay">@null</item> <item name="android:windowFullscreen">true</item> </style>
Declared in the manifest like this:
<activity android:label="@string/app_name" android:name=".activity.DialogActivity" android:theme="@style/TransparentActivity" >
Then I use this as a layout for my dialog:
<?xml version="1.0" encoding="utf-8"?> <FrameLayout xmlns:android="http://schemas.android.com/apk/res/android" android:layout_height="match_parent" android:layout_width="match_parent" android:id="@+id/containerPageContainer"> <FrameLayout android:layout_height="wrap_content" android:layout_width="match_parent" android:background="@drawable/panel_picture_frame_bg_focus_blue" android:layout_gravity="center" android:id="@+id/dialog"/> </FrameLayout>
You can inflate other layouts and add them to @+id/dialog
or use snippets (depending on how brave you are).
Hope this helps!
source share