I have a LinearLayout with horizontal orientation in which I add some TextView and EditText dynamically. My problem is when the TextView is long, it is cut off (by height) and the EditText is invisible.
Adding padding to the views didn't solve it. When setting the LinearLayout minHeight value, the TextView is displayed correctly but the EditText is still invisible.
<LinearLayout
android:id="@+id/content_content"
android:orientation="horizontal"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginTop="20dp"></LinearLayout>
LinearLayout.LayoutParams params = new LinearLayout.LayoutParams(
LinearLayout.LayoutParams.WRAP_CONTENT,
LinearLayout.LayoutParams.WRAP_CONTENT);
for (int i = 0; i < cntCount; i++) {
TextView cntView = new TextView(getActivity());
cntView.setLayoutParams(params);
cntView.setText(cnt.get(i));
contentContentView.addView(cntView);
EditText answerView = new EditText(getActivity());
answerView.setLayoutParams(params);
answerView.setId(i);
answerView.setHint("......");
contentContentView.addView(answerView);
}
EDIT
I have found the solution and created a library. For those interested you can download it here