Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

AlertDialog buttons doesn't fit in dialog box on Android 5.0 #40

Closed
Bersh opened this issue Dec 14, 2014 · 13 comments
Closed

AlertDialog buttons doesn't fit in dialog box on Android 5.0 #40

Bersh opened this issue Dec 14, 2014 · 13 comments

Comments

@Bersh
Copy link

Bersh commented Dec 14, 2014

I've noticed that on Android 5.0 buttons in AlertDialog doesn't fit in dialog box. Similar problem described here: http://stackoverflow.com/questions/26708976/alert-dialog-buttons-problems-in-android-l
Unfortunately I don't have solution for this except of using custom layout for AlertDialog.

Here is few examples how does the problem looks like:

screenshot_2014-12-14-16-49-16
screenshot_2014-12-14-17-20-34

@hotchemi
Copy link
Owner

Oh, thanks...I will investigate about it but ofcourse your pull request is welcome!:)

@hotchemi
Copy link
Owner

@matteinn
Copy link

Any fix for this issue?

@hotchemi
Copy link
Owner

@matteinn @Bersh
Sorry for the delay.
May be this is the default requirements of the android framework.
If you want to solve the problem, you can set buttonBarButtonStyle in your theme to point to a style that extends Widget.Material.Button.Borderless.Colored and adds whatever attributes you need.

@hotchemi
Copy link
Owner

<resources>
    <style name="AppBaseTheme" parent="android:Theme.Material.Light">
        <!-- AlertDialog Style override in order to try to fix non line breaking buttons -->
        <item name="android:alertDialogTheme">@style/CustomAlertDialogStyle</item>
    </style>  

    <style name="CustomAlertDialogStyle" parent="android:Theme.Material.Light.Dialog.Alert">
        <item name="android:buttonBarButtonStyle">@style/CustomButtonBarButtonStyle</item>
        <item name="android:buttonBarStyle">@style/CustomButtonBarStyle</item>
    </style>

    <style name="CustomButtonBarStyle" parent="@android:style/Widget.Material.Light.ButtonBar.AlertDialog">
        <!-- Making sure, the button bar uses parent width and is not restricted in height -->
        <item name="android:layout_width">match_parent</item>
        <item name="android:layout_height">wrap_content</item>
        <item name="android:height">@null</item>
        <item name="android:minHeight">@null</item>
    </style>

    <style name="CustomButtonBarButtonStyle" parent="@android:style/Widget.Material.Light.Button.Borderless.Colored">
        <!-- Setting the weight as follows should result in equally wide buttons filling the alert dialog width,
            but instead they span further out of the dialog, breaking in multiple lines though -->
        <item name="android:layout_width">0dp</item>
        <item name="android:layout_weight">1</item>
        <!-- setting a fixed width as follows results in narrow buttons with line breaks, but of course this is not a solution -->
        <!-- <item name="android:width">100dp</item> -->
    </style>

</resources>

@maarekj
Copy link
Contributor

maarekj commented Jan 29, 2015

Why I was tagged ?

@hotchemi
Copy link
Owner

@maarekj Sorry, my mistake...

@matteinn
Copy link

Thank you @hotchemi .

@hotchemi
Copy link
Owner

@Bersh @matteinn
I will fix this problem at ver 0.5.0. Stay tune:)

@matteinn
Copy link

Coil, thanks!

Sent from a mobile phone, please excuse any auto correct nonsense

On 28 Jun 2015, at 11:55, Shintaro Katafuchi notifications@github.com wrote:

@Bersh @matteinn
I will fix this problem at ver 0.5.0. Stay tune:)


Reply to this email directly or view it on GitHub.

@ollyde
Copy link

ollyde commented Oct 18, 2017

Any traction on this, it's not working currently (49)

@AlexanderLS
Copy link

@voidstarfire it's working on https://github.com/Vorlonsoft/AndroidRate

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

6 participants