在Android的大号警报对话框按钮的问题 [英] Alert dialog buttons problems in Android L

查看:128
本文介绍了在Android的大号警报对话框按钮的问题的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我在我的应用程序创建一个AlertDialog。在Android的大号AlertDialog按钮适合在对话框中,但在Android的大号按钮标签将自动转换成首字母大写和按钮不适合在对话框中。 请看截图: 安卓L:  

Android的奇巧:

是任何人看到这个问题。任何可以帮助我解决这个问题,虽然这是最新的Andr​​oid版本。

code :(我没有使用XML code创建对话框,在这里是用java code:)

  AlertDialog.Builder警报=新AlertDialog.Builder(本);
        alert.setTitle(R.string.feedback_label);
        alert.setMessage(msgStrId);
        alert.setNegativeButton(R.string.close_label,新DialogInterface.OnClickListener(){
            @覆盖
            公共无效的onClick(DialogInterface对话,诠释它){
                // TODO自动生成方法存根
            }
        });
        alert.setPositiveButton(R.string.rate_app,新DialogInterface.OnClickListener(){
            @覆盖
            公共无效的onClick(DialogInterface对话,诠释它){
                // TODO自动生成方法存根
            }
        });
        alert.setNeutralButton(R.string.feedback_label,新DialogInterface.OnClickListener(){
            @覆盖
            公共无效的onClick(DialogInterface对话,诠释其)
            {
                // TODO自动生成方法存根
            }
        });
        alert.setOnCancelListener(新DialogInterface.OnCancelListener()
        {
            @覆盖
            公共无效OnCancel的(DialogInterface对话框)
            {
                // TODO自动生成方法存根
            }
        });
        AlertDialog alertDialog = alert.create();
        alertDialog.show();
 

解决方案

我认为它会为你工作。 https://github.com/drakeet/MaterialDialog

I have created a AlertDialog in my app. Before Android L AlertDialog buttons fit in dialog box, but in Android L buttons label automatically converts in title case and buttons not fit in dialog box. Please see screenshots: Android L:

Android Kitkat:

Is anybody see this issue. Can any help me to solve this problem, although this is latest android version.

Code: (I have not used xml code to create dialog, here is 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();

解决方案

I think it will works For You. https://github.com/drakeet/MaterialDialog

这篇关于在Android的大号警报对话框按钮的问题的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆