I would like to make my own dialog, completely drawn myself, as a custom view. Can I display it in such a way that it displays above all other views and that all touch events, even those outside the dialog's area, are redirected to the dialog?
I find that using a transparent activity and startActivityForResult() gives me a total freedom how I want my "dialog" to look and behave. So I suggest you check it out: How do I create a transparent Activity on Android?
With full screen and a darker background of your choice:
<style name="Theme.Transparent" parent="@android:style/Theme.Translucent.NoTitleBar.Fullscreen">
<item name="android:windowBackground">@color/transparentActivityBackground</item>
</style>
Then in strings.xml:
<color name="transparentActivityBackground">#55000000</color>
If you want to blur the screen of the previous activity then use this line before setContentView:
this.getWindow().addFlags(WindowManager.LayoutParams.FLAG_BLUR_BEHIND);
This should be possible by setting the height/width of the root element to anything but fill_parent
.
You could also achieve this by creating a custom theme that inherits from the built in android dialog theme.
http://developer.android.com/guide/topics/ui/themes.html
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With