亚洲在线久爱草,狠狠天天香蕉网,天天搞日日干久草,伊人亚洲日本欧美

為了賬號安全,請及時綁定郵箱和手機立即綁定

progressdialog.setButton(DialogInterface.BUTTON_POSITIVE, "確定", new DialogInterface(){ @Override public void onClick(DialogInterface dialog,int which) { Toast.makeText(MainActivity3.this, "welcome", Toast.LENGTH_SHORT).show(); } }); 一模一樣的代碼還是有點錯 是不是因為android版本的問

正在回答

7 回答

proDialog.setButton(DialogInterface.BUTTON_POSITIVE,?"確定",?new?DialogInterface.OnClickListener()?{
????????????@Override
????????????public?void?onClick(DialogInterface?dialog,?int?which)?{
?????????????Toast.makeText(MainActivity.this,"歡迎你的關注",?Toast.LENGTH_SHORT).show();
????????????}
????????}
);

這個里面的參數有大小寫不同或是都經常會報錯,細心一點就可以了

0 回復 有任何疑惑可以回復我~

new?DialogInterface.OnClickListener(){}

.setButton(int whichButton,Button text,OnClickListener Listener)

0 回復 有任何疑惑可以回復我~

最后一個參數錯了, 應該是new DialogInterface.OnClickListener()

3 回復 有任何疑惑可以回復我~
#1

芒種啊

老師我想問一下:proDialog.setButton(DialogInterface.BUTTON_POSITIVE, "確定", new DialogInterface.OnClickListener()這個的確定具體作用和返回有什么不一樣啊。還有DialogInterface.BUTTON_POSITIVE是表達什么,另外兩個呢?
2016-01-07 回復 有任何疑惑可以回復我~
#2

ZZLLLLL

只是在android的alertDialog中封裝好的一些Button 這些Button和普通的Button沒有任何區別,可以寫任意的方法,只是命名上的不同,一般有三個Button:PositiveButton,NegativeButton,NeutralButton。從名字可以看的出來,代表確定,否定,和中立,其實三個Button可以寫你任意的方法,只是位置上的不同而已,確定Button一般靠左,這是閱讀習慣。本質上都是三個Button并沒有很大的區別,也許可能NegativeButton里面寫了dismiss方法
2016-08-13 回復 有任何疑惑可以回復我~

第二條錯誤提示:The method onClick(DialogInterface, int) of type new DialogInterface(){} must override or implement a supertype method

0 回復 有任何疑惑可以回復我~

The type new DialogInterface(){} must implement the inherited abstract method DialogInterface.dismiss() 發不下分幾條發 (這是第一個錯誤)

0 回復 有任何疑惑可以回復我~

Multiple markers at this line - The type new DialogInterface(){} must implement the inherited abstract method DialogInterface.cancel() - The method setButton(int, CharSequence, Message) in the type AlertDialog is not applicable for the arguments (int, String, new DialogInterface(){})

0 回復 有任何疑惑可以回復我~

錯誤信息是什么???

0 回復 有任何疑惑可以回復我~

舉報

0/150
提交
取消
Android攻城獅的第二門課(第1季)
  • 參與學習       111140    人
  • 解答問題       1560    個

本課程由淺入深地帶您學會Android的常用控件的開發和使用

進入課程
微信客服

購課補貼
聯系客服咨詢優惠詳情

幫助反饋 APP下載

慕課網APP
您的移動學習伙伴

公眾號

掃描二維碼
關注慕課網微信公眾號