I managed to adjust the width like this:
<style name="NarrowDialog" parent="Theme.AppCompat.Light.Dialog.Alert"> <item name="windowFixedWidthMajor">70%</item> <item name="windowFixedWidthMinor">70%</item> </style>
Dialog dialog = new AlertDialog.Builder(this, R.style.NarrowDialog)...
There is also a minimum width that you can customize:
<item name="windowMinWidthMajor">65%</item> <item name="windowMinWidthMinor">65%</item>
Attribute Information
windowFixedHeightMajor: Fixed height for the window along the main axis of the screen, that is, when in the portrait.
windowFixedHeightMinor: Fixed height for the window along the secondary axis of the screen, i.e. in the landscape.
windowFixedWidthMajor: The fixed width of the window along the main axis of the screen, i.e. in the landscape.
windowFixedWidthMinor: The fixed width of the window along the secondary axis of the screen, i.e. for portrait orientation.
Tim Malseed Oct 07 '16 at 0:23 2016-10-07 00:23
source share