1
Hello, I created a list of questions within a Listview, I created all the questions by programming, I’m not doing any components in the.xml layout, I just have a frameLayout, but the moment I click on the edittext it doesn’t let me type, I click and the keyboard of the phone appears and disappears quickly, anyone knows what can be? And how to solve ?
Follow the editext creation code:
public LinearLayout createEditText(String question, int line, EditText editText){
LinearLayout linearLayout = new LinearLayout(context);
linearLayout.setOrientation(LinearLayout.VERTICAL);
ViewGroup.LayoutParams lpView = new ViewGroup.LayoutParams(ViewGroup.LayoutParams.MATCH_PARENT, ViewGroup.LayoutParams.WRAP_CONTENT);
ViewGroup.LayoutParams
lpViewEdit = new ViewGroup.LayoutParams(ViewGroup.LayoutParams.MATCH_PARENT, ViewGroup.LayoutParams.WRAP_CONTENT);
TextView tv = new TextView(context);
tv.setTextColor(Color.BLACK);
tv.setText(question);
tv.setLayoutParams(lpView);
linearLayout.addView(tv);
editText= new EditText(context);
editText.setEnabled(true);
editText.setInputType(InputType.TYPE_CLASS_TEXT);
editText.setFocusable(true);
editText.setMaxLines(10);
editText.setEms(2);
editText.setLayoutParams(lpViewEdit);
linearLayout.addView(editText);
return linearLayout;
}
Follow the code where I’m calling this method of creation:
editText = new EditText(context);
frameLayout.addView(createEditText(id + "." + listaPergunta.get(position).getTxtPergunta(), lines, editText));
You have to enter your code here, otherwise it becomes difficult to help you.
– viana