일부 textView가 포함 된 레이아웃을 팽창 시키려고합니다. tableRow에 추가하면 해당 레이아웃 내부의 textViews가 겹쳐집니다. 즉, layout_width 및 layout_height가 무시되고있는 것 같습니다.팽창 된 레이아웃의 자식이 TableRow에 추가 될 때 서로 겹치다
하지만 팽창시킨 후 rowView.setLayoutParams(new ViewGroup.LayoutParams(ViewGroup.LayoutParams.MATCH_PARENT, ViewGroup.LayoutParams.WRAP_CONTENT));
을 추가하면 아무 것도 나타나지 않습니다.
TableRow tableRow = new TableRow(this);
TableRow.LayoutParams lp = new TableRow.LayoutParams(TableRow.LayoutParams.MATCH_PARENT, TableRow.LayoutParams.WRAP_CONTENT);
tableRow.setLayoutParams(lp);
View rowView = getLayoutInflater().inflate(R.layout.layout_result_row, null);
rowView.setLayoutParams(new ViewGroup.LayoutParams(ViewGroup.LayoutParams.MATCH_PARENT, ViewGroup.LayoutParams.WRAP_CONTENT));
loadResultRow(rowView, result); //This method sets the text of the textViews
tableRow.addView(rowView);
tableLayout.addView(tableRow);
layout_result_row.xml
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:id="@+id/results_row_layout"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="vertical"
android:paddingBottom="16dp">
<TextView
android:id="@+id/results_row_match_no"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentStart="true"
android:layout_alignParentTop="true"
android:text="TextView" />
<TextView
android:id="@+id/results_row_turn"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignBottom="@+id/results_row_match_no"
android:layout_alignParentEnd="true"
android:text="TextView" />
<TextView
android:id="@+id/results_row_teams"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentTop="true"
android:layout_toEndOf="@+id/results_row_match_no"
android:text="TextView" />
<TextView
android:id="@+id/results_row_turn_text"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignBottom="@+id/results_row_turn"
android:layout_toStartOf="@+id/results_row_turn"
android:text="TextView" />
<TextView
android:id="@+id/results_row_toss_ml"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentStart="true"
android:layout_below="@+id/results_row_match_no"
android:layout_marginTop="22dp"
android:text="TextView" />
<TextView
android:id="@+id/results_row_home_ml"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignBaseline="@+id/results_row_toss_ml"
android:layout_alignBottom="@+id/results_row_toss_ml"
android:layout_centerHorizontal="true"
android:text="TextView" />
<TextView
android:id="@+id/results_row_rank_ml"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignTop="@+id/results_row_home_ml"
android:layout_toEndOf="@+id/results_row_turn_text"
android:text="TextView" />
<TextView
android:id="@+id/results_row_result"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignBottom="@+id/results_row_turn_text"
android:layout_alignStart="@+id/results_row_home_ml"
android:text="TextView" />
</RelativeLayout>
는'(참) tableLayout.setStretchAllColumns는'이 트릭을했다. 고마워. –