EditText On A Popup Window

前端 未结 5 2182
抹茶落季
抹茶落季 2020-12-05 19:43

I am developing on Android 2.2 using Java. I put an editText on a PopupWindow and it\'s not working. It acts like a disabled edit text, clicking on the edit text won\'t sho

5条回答
  •  我在风中等你
    2020-12-05 20:12

    Just try:

    AlertDialog.Builder alert = new AlertDialog.Builder(this);
    
    alert.setTitle("Title");
    alert.setMessage("Message");
    
    // Set an EditText view to get user input 
    final EditText input = new EditText(this);
    alert.setView(input);
    
    alert.setPositiveButton("Ok", new DialogInterface.OnClickListener() {
    public void onClick(DialogInterface dialog, int whichButton) {
    
      // Do something with value!
      }
    });
    
    alert.setNegativeButton("Cancel", new DialogInterface.OnClickListener() {
      public void onClick(DialogInterface dialog, int whichButton) {
        // Canceled.
      }
    });
    
    alert.show();
    

提交回复
热议问题