I've created my own (custom) Dialog. But would like to have its style like original Alert Dialog. I.e. with dark title background and grey buttons background on the bottom. Is there any ready-for-use xml with the same? (so, I wouldn't worry about exact colors, heights, font sizes etc.)
This answer is incorrect
Use Theme.Dialog.Alert
From themes.xml:
<!-- Default theme for alert dialog windows, which is used by the
{@link android.app.AlertDialog} class. This is basically a dialog
but sets the background to empty so it can do two-tone backgrounds. -->
<style name="Theme.Dialog.Alert" parent="@android:style/Theme.Dialog">
<item name="windowBackground">@android:color/transparent</item>
<item name="windowTitleStyle">@android:style/DialogWindowTitle</item>
<item name="windowIsFloating">true</item>
<item name="windowContentOverlay">@null</item>
</style>
This can then be applied within an XML layout or Android manifest, as referenced here:
<activity android:theme="@android:style/Theme.Dialog.Alert">
Or onto an Activity using setTheme(int)
. However, this does not seem to be a recommended practice. Simple sample code shown in this bug report.