android 輸入對話框

/**添加事項對話框*/
       LayoutInflater inflater = LayoutInflater.from(PropertySetActivity.this);
       final View textEntryView = inflater.inflate(R.layout.alert_dialog_text_entry, null);
       final EditText eventNameET = (EditText)textEntryView.findViewById(R.id.eventNameET);
       new AlertDialog.Builder(PropertySetActivity.this)
       .setIcon(R.drawable.alert_dialog_icon)
       .setTitle("親,請添加代辦事項名稱")
       .setView(textEntryView)
       .setPositiveButton("確定", new DialogInterface.OnClickListener() {
           public void onClick(DialogInterface dialog, int which) {
               eventName = eventNameET.getText().toString();
           }
       })
       .setNegativeButton("取消", new DialogInterface.OnClickListener() {
           public void onClick(DialogInterface dialog, int which) {
               Toast.makeText(PropertySetActivity.this, "親,您沒有對代辦事項命名!", Toast.LENGTH_SHORT).show();
           }
       })
       .show();
       /**添加事項對話框*/
發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章