課程
/移動(dòng)開(kāi)發(fā)
/Android
/Android攻城獅的第二門課(第2季)
Andorid Studio對(duì)話框怎么弄?AlterDialog AS里面好像沒(méi)有這個(gè),那么 AS是怎么彈出對(duì)話框的
2016-07-16
源自:Android攻城獅的第二門課(第2季) 4-2
正在回答
我設(shè)置了一個(gè)Button按鈕 (想截圖給你看 但是不知道是我電腦的原因還是IMOOC的問(wèn)題 這個(gè)圖片上傳總是出錯(cuò))
總是就是一個(gè)普通的按鈕 點(diǎn)擊之后彈出對(duì)話框
以下內(nèi)容是MainActivity中的內(nèi)容:
private Button loginButton;private String TAG="DialogTest1";
loginButton = (Button)findViewById(R.id.button); ? ?loginButton.setOnClickListener(new View.OnClickListener() { ? ? ? ?@Override ? ? ? ?public void onClick(View v) { ? ? ? ? ? ?new AlertDialog.Builder(MainActivity.this) ? ? ? ? ? ? ? ? ? ?.setTitle(R.string.title_name) ? ? ? ? ? ? ? ? ? ?.setMessage(R.string.message_name) ? ? ? ? ? ? ? ? ? ?.setPositiveButton(R.string.btn1_name, new DialogInterface.OnClickListener() { ? ? ? ? ? ? ? ? ? ? ? ?public void onClick(DialogInterface dialog, int which) { ? ? ? ? ? ? ? ? ? ? ? ? ? ?Log.v(TAG, "你點(diǎn)擊了確定"); ? ? ? ? ? ? ? ? ? ? ? ? ? ?//activity finish ? ? ? ? ? ? ? ? ? ? ? ? ? ?finish(); ? ? ? ? ? ? ? ? ? ? ? ?} ? ? ? ? ? ? ? ? ? ?}) ? ? ? ? ? ? ? ? ? ?.setNegativeButton(R.string.btn2_name, new DialogInterface.OnClickListener() { ? ? ? ? ? ? ? ? ? ? ? ?public void onClick(DialogInterface dialog, int which) { ? ? ? ? ? ? ? ? ? ? ? ? ? ?Log.v(TAG, "你點(diǎn)擊了取消"); ? ? ? ? ? ? ? ? ? ? ? ? ? ?//activity finish ? ? ? ? ? ? ? ? ? ? ? ? ? ?finish(); ? ? ? ? ? ? ? ? ? ? ? ?} ? ? ? ? ? ? ? ? ? ?}) ? ? ? ? ? ? ? ? ? ?.show(); ? ?} ? ?});}protected void onDestroy() { ? ?super.onDestroy(); ? ?Log.v(TAG,"activity finish");}
hao小子 提問(wèn)者
采納我行不行,三積分別浪費(fèi)了:)
知道了 。。打錯(cuò)了 AlertDialog?
我打出的AlterDialog 報(bào)錯(cuò) 自動(dòng)補(bǔ)充提示里面也沒(méi)有找到這個(gè)AlterDialog
舉報(bào)
本課程講帶你熟悉Android開(kāi)發(fā)中常用的調(diào)試方式,菜單、調(diào)試程序
Copyright ? 2025 imooc.com All Rights Reserved | 京ICP備12003892號(hào)-11 京公網(wǎng)安備11010802030151號(hào)
購(gòu)課補(bǔ)貼聯(lián)系客服咨詢優(yōu)惠詳情
慕課網(wǎng)APP您的移動(dòng)學(xué)習(xí)伙伴
掃描二維碼關(guān)注慕課網(wǎng)微信公眾號(hào)
2016-09-18
我設(shè)置了一個(gè)Button按鈕 (想截圖給你看 但是不知道是我電腦的原因還是IMOOC的問(wèn)題 這個(gè)圖片上傳總是出錯(cuò))
總是就是一個(gè)普通的按鈕 點(diǎn)擊之后彈出對(duì)話框
以下內(nèi)容是MainActivity中的內(nèi)容:
private Button loginButton;
private String TAG="DialogTest1";
loginButton = (Button)findViewById(R.id.button);
? ?loginButton.setOnClickListener(new View.OnClickListener() {
? ? ? ?@Override
? ? ? ?public void onClick(View v) {
? ? ? ? ? ?new AlertDialog.Builder(MainActivity.this)
? ? ? ? ? ? ? ? ? ?.setTitle(R.string.title_name)
? ? ? ? ? ? ? ? ? ?.setMessage(R.string.message_name)
? ? ? ? ? ? ? ? ? ?.setPositiveButton(R.string.btn1_name, new DialogInterface.OnClickListener() {
? ? ? ? ? ? ? ? ? ? ? ?public void onClick(DialogInterface dialog, int which) {
? ? ? ? ? ? ? ? ? ? ? ? ? ?Log.v(TAG, "你點(diǎn)擊了確定");
? ? ? ? ? ? ? ? ? ? ? ? ? ?//activity finish
? ? ? ? ? ? ? ? ? ? ? ? ? ?finish();
? ? ? ? ? ? ? ? ? ? ? ?}
? ? ? ? ? ? ? ? ? ?})
? ? ? ? ? ? ? ? ? ?.setNegativeButton(R.string.btn2_name, new DialogInterface.OnClickListener() {
? ? ? ? ? ? ? ? ? ? ? ?public void onClick(DialogInterface dialog, int which) {
? ? ? ? ? ? ? ? ? ? ? ? ? ?Log.v(TAG, "你點(diǎn)擊了取消");
? ? ? ? ? ? ? ? ? ? ? ? ? ?//activity finish
? ? ? ? ? ? ? ? ? ? ? ? ? ?finish();
? ? ? ? ? ? ? ? ? ? ? ?}
? ? ? ? ? ? ? ? ? ?})
? ? ? ? ? ? ? ? ? ?.show();
? ?}
? ?});
}
protected void onDestroy() {
? ?super.onDestroy();
? ?Log.v(TAG,"activity finish");
}
2016-08-11
采納我行不行,三積分別浪費(fèi)了:)
2016-07-16
知道了 。。打錯(cuò)了 AlertDialog?
2016-07-16
我打出的AlterDialog 報(bào)錯(cuò) 自動(dòng)補(bǔ)充提示里面也沒(méi)有找到這個(gè)AlterDialog