2015-10-20 32 views
-1

創建EditText動態,但是當我點擊它們插入數據時,鍵盤不會打開。的Android的EditText動態

MaterialEditText ed = new MaterialEditText(getApplicationContext()); 
LinearLayout.LayoutParams layoutParams = new LinearLayout.LayoutParams(
LinearLayout.LayoutParams.MATCH_PARENT, LinearLayout.LayoutParams.WRAP_CONTENT); 

layoutParams.setMargins(0, 20, 30, 0); 
rlCampi.addView(ed, layoutParams); 
+0

MaterialEditText:你用的是什麼版本? –

+0

這個:https://github.com/rengwuxian/MaterialEditText –

+0

@DeboraCarnevali很樂意幫助你:)快樂編碼 –

回答

0

只是這個

youredittextname.setFocusableInTouchMode(true); 
    youredittextname.requestFocus(); 
0

嘗試添加編輯文本試試這個方法:

// Pass it an Activity or Context 
    EditText myEditText = new EditText(context); 
// Pass two args; must be LayoutParams.MATCH_PARENT, LayoutParams.WRAP_CONTENT, or an integer pixel value. 
    myEditText.setLayoutParams(new LayoutParams(..., ...)); 
    myLayout.addView(myEditText); 
相關問題