Warning: file_get_contents(/data/phpspider/zhask/data//catemap/3/android/227.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181

Warning: file_get_contents(/data/phpspider/zhask/data//catemap/8/meteor/3.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Android 在AlertDialog中,垂直方向显示的按钮_Android_Button_Android Alertdialog - Fatal编程技术网

Android 在AlertDialog中,垂直方向显示的按钮

Android 在AlertDialog中,垂直方向显示的按钮,android,button,android-alertdialog,Android,Button,Android Alertdialog,buildToolsVersion“23.0.3” targetSdkVersion 23 当我尝试在我的android.support.v7.app.AlertDialog上添加3个按钮时,按钮显示为垂直方向(而不是水平方向)。是虫子吗 这是我的密码: new AlertDialog.Builder(context) .setMessage("My message") .setPositiveButton("Positive Bu

buildToolsVersion“23.0.3”

targetSdkVersion 23

当我尝试在我的
android.support.v7.app.AlertDialog
上添加3个按钮时,按钮显示为垂直方向(而不是水平方向)。是虫子吗

这是我的密码:

new AlertDialog.Builder(context)
                .setMessage("My message")
                .setPositiveButton("Positive Button", new DialogInterface.OnClickListener()
                {
                    @Override
                    public void onClick(DialogInterface dialog, int which)
                    {

                    }
                })
                .setNegativeButton("Negative Button", new DialogInterface.OnClickListener()
                {
                    @Override
                    public void onClick(DialogInterface dialog, int which)
                    {

                    }
                })
                .setNeutralButton("Neutral Button", new DialogInterface.OnClickListener()
                {
                    @Override
                    public void onClick(DialogInterface dialog, int which)
                    {

                    }
                })
                .show();

这是因为名称是长名称,请尝试短名称,如“确定”而不是“肯定”按钮、“取消”而不是“否定”按钮等等,您可以尝试自定义警报对话框

写一个简单的风格:

<style name="RightButtonsDialog" parent="Theme.AppCompat.Dialog.Alert">
    <item name="android:buttonBarButtonStyle">@style/RightButtonBarButtonStyle</item>
</style>

<style name="RightButtonBarButtonStyle" parent="Widget.AppCompat.Button.ButtonBar.AlertDialog">
    <item name="android:gravity">end</item>
</style>

@样式/右按钮按钮样式
结束

如何使用样式:
AlertDialog.Builder(context,R.style.RightButtonBarButtonStyle)

但我只有两个名称较短且仍然垂直的按钮