Create a multiline EditText programmatically

前端 未结 8 1260
無奈伤痛
無奈伤痛 2021-01-03 21:58

I am trying to create a multiline EditText by code. This is what I use:

EditText txt = new EditText(this);    
lp = new LinearLayout.LayoutParams(LayoutParam         


        
8条回答
  •  刺人心
    刺人心 (楼主)
    2021-01-03 22:32

    This should do it

    txt.setSingleLine(false);
    txt.setImeOptions(EditorInfo.IME_FLAG_NO_ENTER_ACTION);
    

提交回复
热议问题