Skip to content

Instantly share code, notes, and snippets.

@dominicthomas
Created November 22, 2013 15:25
Show Gist options
  • Save dominicthomas/7601669 to your computer and use it in GitHub Desktop.
Save dominicthomas/7601669 to your computer and use it in GitHub Desktop.
Simple dialog using a custom layout displayed full screen over the content, with no title or border etc..
private Dialog getCustomDialog(String productSpecs) {
final Dialog dialog = new Dialog(this, R.style.Dialog);
dialog.requestWindowFeature(Window.FEATURE_NO_TITLE);
dialog.getWindow().setBackgroundDrawable(new ColorDrawable(0));
dialog.setCancelable(true);
dialog.setContentView(R.layout.some_layout);
// dialog.findViewById stuff here...
return dialog;
}
<style name="Dialog">
<item name="android:windowFrame">@null</item>
<item name="android:windowIsFloating">true</item>
<item name="android:windowContentOverlay">@null</item>
<item name="android:windowIsTranslucent">true</item>
<item name="android:windowAnimationStyle">@android:style/Animation.Dialog</item>
<item name="android:windowBackground">@color/color_dialog_window_background</item>
<item name="android:windowSoftInputMode">stateUnspecified|adjustPan</item>
<item name="android:colorBackgroundCacheHint">@null</item>
<item name="android:backgroundDimEnabled">false</item>
</style>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment