setPositiveButton和setNegativeButton的区别
                                                            生活随笔
收集整理的這篇文章主要介紹了
                                setPositiveButton和setNegativeButton的区别
小編覺得挺不錯的,現在分享給大家,幫大家做個參考.                        
                                setPositiveButton和setNegativeButton的區別和setNeutralButton的區別
三者都是AlertDialog彈出框的按鈕,都是封裝好的button,只是顯示的位置不同,項目中可根據情況選擇使用,setNegativeButton一般用于確認,setNegativeButton一般用于取消。
new AlertDialog.Builder(MainActivity.this).setTitle("dialog").setMessage("三者的區別").setPositiveButton("positive", new DialogInterface.OnClickListener() {@Overridepublic void onClick(DialogInterface dialog, int which) {}}).setNegativeButton("negative", new DialogInterface.OnClickListener() {@Overridepublic void onClick(DialogInterface dialog, int which) {}}).setNeutralButton("neutral", new DialogInterface.OnClickListener() {@Overridepublic void onClick(DialogInterface dialogInterface, int i) {}}).show();總結
以上是生活随笔為你收集整理的setPositiveButton和setNegativeButton的区别的全部內容,希望文章能夠幫你解決所遇到的問題。
 
                            
                        - 上一篇: 修改mdf ldf文件权限修改方法
- 下一篇: pug 编译html,pug之HTML模
