最近製作一些表格視窗來填寫資料,

 

剛好也預道這個問題,

 

就是說創造一個視窗後卻不知道如何結束。

LayoutInflater layoutInflater = LayoutInflater.from(SetListActivity.this);
View promptView = layoutInflater.inflate(R.layout.input_con_dialogfragment, null);
final AlertDialog.Builder alertDialogBuilder = new AlertDialog.Builder(SetActivity.this);
final AlertDialog alert = alertDialogBuilder.create();
alert.show();
btnDone.setOnClickListener(new View.OnClickListener() {
public void onClick(View view) {


alert.cancel();



}


});

主要是需要創造一個AlertDialog來顯示螢幕,這樣就可以使用alert.cancel裡面的功能還關閉。

當初找這個問題點也找很久....,希望這對設計程式的大家有幫助。



android stdio,android app,app功能設定
arrow
arrow

    怪獸 發表在 痞客邦 留言(1) 人氣()