我在我的应用程序中创建了一个 AlertDialog。在 Android L 之前,AlertDialog 按钮适合对话框,但在 Android L 中,按钮标签自动转换为标题大小写,按钮不适合对话框。 请看截图:
安卓大号:
Android 奇巧:
有人看到这个问题吗?任何人都可以帮助我解决这个问题,尽管这是最新的 android 版本。
代码:(我没有用xml代码创建对话框,这里是java代码:)
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();
最佳答案
我知道,我来不及了。但我在这里分享我的建议。也许会有帮助。
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();
关于android - Android L 中的警报对话框按钮问题,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/26708976/