机器人AlertDialog移动PositiveButton到左侧的右和NegativeButton [英] Android AlertDialog Move PositiveButton to the right and NegativeButton on the left
问题描述
我是新与Android。
I'm new with android.
目前我想说明与'OK'和一个 AlertDialog
箱; 取消按钮。
Currently I want to show an AlertDialog
box with 'OK' & 'Cancel' buttons.
默认为PositiveButton:左,NegativeButton:右
The default is PositiveButton: Left, NegativeButton: Right
您可以让我知道我怎么可以移动PositiveButton到右侧和放大器; NegativeButton到左侧?
Can you let me know how can I move the PositiveButton to the right side & NegativeButton to the left side?
是否有任何机会/麻烦,如果Negativebutton造成不好的声音时pressing好吧,如果我们的文字OK更改为NegativeButton&安培; 取消PositiveButton。
Is there any chance/trouble if Negativebutton cause a bad sound when pressing OK, if We change text "OK" to NegativeButton & "Cancel" to PositiveButton.
我的code:
AlertDialog.Builder builder = new AlertDialog.Builder(SUtils.getContext());
builder.setMessage("Confirmation?")
.setCancelable(false)
.setNegativeButton("Cancel", new DialogInterface.OnClickListener() {
public void onClick(DialogInterface dialog, int id) {
//Todo
dialog.cancel();
}
})
.setPositiveButton("OK", new DialogInterface.OnClickListener() {
public void onClick(DialogInterface dialog, int id) {
//TOdo
}
})
dialog = builder.create();
谢谢, 天使
Thanks, Angel
推荐答案
这可能不是一个直接的答案。但就在相关主题的一些信息。从在谷歌自己的论坛,这线,罗曼家伙说..
This might not be a direct answer. But just some information on related topic. From this thread in Google's own forum, Romain guy said..
展望未来的正/负按钮的顺序将是一个 在ICS中使用。
Going forward the order of positive/negative buttons will be the one used in ICS.
和每个OS版本的约定是
and the convention per OS version is
- 在设备前,蜂窝,按钮顺序(从左至右)的 正 - 中性 - 负
- 在使用的Holo主题较新的设备,按钮顺序(左 右图)现在是负 - 中性 - 正
- On devices prior to Honeycomb, the button order (left to right) was POSITIVE - NEUTRAL - NEGATIVE.
- On newer devices using the Holo theme, the button order (left to right) is now NEGATIVE - NEUTRAL - POSITIVE.
如果这是一个惯例,即机器人/谷歌希望效仿,是不是更好,你遵循同样的,因为你的用户将不会被单独使用你的应用程序。毕竟用户友好性是一个开发者寻找的第一件事。
If it is a convention, that android/Google wants to follow, isn't it better you follow the same, since your users won't be using your app alone. After all user friendliness is the first thing a developer looks for..
这篇关于机器人AlertDialog移动PositiveButton到左侧的右和NegativeButton的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!