2012-09-21 2 views
0

나는 사용자가 버튼을 클릭했을 때 보여에 AlertDialog가 표시되지 : 나는 몇 가지를 시도했습니다키보드가 자동으로

public class CommentDialog { 

public static void buildDialog(final Context context, 
     final String identifier, Boolean automaticKeyboard, 
     final int idToUpdate) { 


    AlertDialog.Builder alert = new AlertDialog.Builder(context); 
    alert.setIcon(ViewBuilder.getDrawableFromDB("text.png")); 
    alert.setTitle("Commentaar"); 

    // Edittext configuration// 
    final EditText input = new EditText(context); 

    String currentComment = EnteredValues.getInstance() 
      .getValueForIdentifier(identifier); 

    if (currentComment != null) { 
     input.setText(currentComment); 
     input.setSelection(currentComment.length()); 
    } 

    input.setHint("Gelieve uw commentaar in te voeren."); 

    Display display = ((WindowManager) context 
      .getSystemService(Context.WINDOW_SERVICE)).getDefaultDisplay(); 
    int width = display.getWidth(); 

    input.setMinimumWidth(width); 
    input.setMaxLines(3); 
    input.setImeOptions(EditorInfo.IME_ACTION_DONE); 
    input.setFocusableInTouchMode(true); 
    input.requestFocus(); 


    final InputMethodManager inputMethodManager = (InputMethodManager) context 
      .getSystemService(Context.INPUT_METHOD_SERVICE); 
    inputMethodManager.showSoftInput(input, 
      InputMethodManager.SHOW_IMPLICIT); 

    // Add edittext to dialog 
    alert.setView(input); 

    // Set actions of dialog 
    alert.setPositiveButton("Bewaren", 
      new DialogInterface.OnClickListener() { 
       public void onClick(DialogInterface dialog, int whichButton) { 

        String value = input.getText().toString(); 

        EnteredValues.getInstance().addValue(identifier, value); 

        View v = ShowScreenActivity.mActivity 
          .findViewById(idToUpdate); 
        EditText e = ((EditText) v); 
        e.setText(value); 
        e.setSelection(e.getText().length()); 

        return; 
       } 
      }); 

    alert.setNegativeButton("Cancel", 
      new DialogInterface.OnClickListener() { 
       public void onClick(DialogInterface dialog, int which) { 

        return; 
       } 
      }); 

    alert.show(); 
} 
} 

,하지만 키보드가 자동으로 표시되지 않습니다. 벌집 모양의 갤럭시 탭 10.1과 함께 장치에 의존하는 것처럼 보입니다. 키보드가 나타납니다. 하지만 2.3.6에있는 은하 gio와 함께하지 않습니다.

어떤 생각?

+0

당신은 SHOW_FORCE를 사용하는 것을 시도했다 같은 매니페스트에 시도하는 데 도움이? 화면 크기/기기 별이며 'android : imeOptions'(flagNoFullscreen 포함)입니다. 아마도 시스템 대화 상자 (예 : Wi-Fi 연결)가 동일한 방식으로 작동하기 때문에 그대로 두어야합니다. – sandrstar

답변

0

이 5 월은

<activity 
      android:name=".YourActivity" 
      android:windowSoftInputMode="stateHidden"> </activity> 
관련 문제