我自定義了一個view,然后呼叫setView的方法進行設定。其中view里面兩個button設定監聽,點擊后就使其消失。但是一直不知道怎么寫,也無法呼叫dialog.dismiss();同時,也設定了一個navihationbutton可以正常消失
uj5u.com熱心網友回復:
AlertDialog.Builder builder = new AlertDialog.Builder(context);
View viewDialog = View.inflate(context, R.layout.dialog_plans_details, null);
builder.setView(viewDialog);
final AlertDialog alertDialog = builder.create();
alertDialog.create();
alertDialog.show();
這樣就可以在你想要呼叫dismiss的時候 用alertDialog.dismiss就OK啦
轉載請註明出處,本文鏈接:https://www.uj5u.com/yidong/18836.html
標籤:移動開發其他問題
上一篇:微信小程式獲取openid 報錯TypeError: Cannot read property 'openId' of undefined
下一篇:Fatal signal 6 (SIGABRT), code -6 in tid 28552 (RenderThread), pid 28509
