Problems with warning dialog buttons in Android L

I created an AlertDialog in my application. Prior to Android L, AlertDialog buttons are placed in the dialog box, but in Android L the button label is automatically converted to the title register, and the buttons are not placed in the dialog box. Please see screenshots:

Android L:
Android L AlertDialog screenshot

Android Kitkat:

Android 4.4 AlertDialog screenshot

Does anyone see this problem. Can it help me solve this problem, although this is the latest version of Android.

Code : (I did not use the XML code to create the dialog, here is the Java code :)

AlertDialog.Builder alert = new AlertDialog.Builder(this); alert.setTitle(R.string.feedback_label); alert.setMessage(msgStrId); alert.setNegativeButton(R.string.close_label, new DialogInterface.OnClickListener() { @Override public void onClick(DialogInterface dialog, int which) { // TODO Auto-generated method stub } }); alert.setPositiveButton(R.string.rate_app, new DialogInterface.OnClickListener() { @Override public void onClick(DialogInterface dialog, int which) { // TODO Auto-generated method stub } }); alert.setNeutralButton(R.string.feedback_label,new DialogInterface.OnClickListener() { @Override public void onClick(DialogInterface dialog, int which) { // TODO Auto-generated method stub } }); alert.setOnCancelListener(new DialogInterface.OnCancelListener() { @Override public void onCancel(DialogInterface dialog) { // TODO Auto-generated method stub } }); AlertDialog alertDialog = alert.create(); alertDialog.show(); 
+7
android android-5.0-lollipop android-alertdialog
source share
6 answers

I know I'm too late. But I share my suggestion here. Perhaps this will be useful.

  AlertDialog alertDialog = alert.create(); alertDialog .show(); alertDialog.getButton(DialogInterface.BUTTON_NEGATIVE).setAllCaps(false); alertDialog.getButton(DialogInterface.BUTTON_POSITIVE).setAllCaps(false); alertDialog.getButton(DialogInterface.BUTTON_NEUTRAL).setAllCaps(false); alertDialog.show(); 
+6
source share

I think this will work for you. https://github.com/drakeet/MaterialDialog

0
source share

A slight change to @Kush's answer. You do not need to call dialog.show() multiple times.

 AlertDialog.Builder builder = new AlertDialog.Builder(MyActivity.this); builder.setTitle("Title"); builder.setMessage("message"); builder.setPositiveButton("Ok", new DialogInterface.OnClickListener() { @Override public void onClick(DialogInterface dialog, int which) { //Do Something } }); AlertDialog dialog = builder.create(); dialog.show(); dialog.getButton(AlertDialog.BUTTON_POSITIVE).setAllCaps(false); 
0
source share
  AlertDialog.Builder builder = new AlertDialog.Builder(this, R.style.MyAlertDialogStyle); 

styles.xml

 <style name="MyAlertDialogStyle" parent="Theme.AppCompat.Light.Dialog"> <item name="android:textAllCaps">false</item> </style> 
0
source share

If you try to find a solution for this, then you can get, but also for the small screens that you are stuck again, and you also need to find something.

So better split the line so that it solves your problem for any screen.

The code below is for this.

Go to the strings.xml file. and change your title as shown below.

  <string name="rate_app">Rate This \n App</string> <string name="feedback_label">Report \n Issues</string> 

If "\ n" does not work, then the user tag
. Hope this helps you.

-one
source share

Use <item name="android:textAllCaps">false</item> in the theme definition of your application. Then all the dialogs in the application do not matter in uppercase.

-3
source share

All Articles