我有一个动态获取数据的tablelayout。我想将行转换为列。我改变了方向,但没有工作。
TableLayout tableLayout = (TableLayout) second_row_b.findViewById(R.id.table_current_picks);
List<PickGame> selectedPicks = buildSelectedPicks(response);
int selectedPicksSize = selectedPicks.size() > 5 ? 5 : selectedPicks.size();
for (int i = 0; i < selectedPicksSize; i++) {
TableRow rowView = (TableRow) inflater.inflate(R.layout.include_current_picks_row, null);
TableLayout.LayoutParams rowParams = new TableLayout.LayoutParams(TableLayout.LayoutParams.WRAP_CONTENT, 0, 0.1f);
tableLayout.addView(rowView, rowParams);
PickGame pickGame = selectedPicks.get(i);
TextView totalPointsText = (TextView) rowView.findViewById(R.id.text_total_points);
TextView gamePointsText = (TextView) rowView.findViewById(R.id.text_game_points);
NetworkImageView imageView = (NetworkImageView) rowView.findViewById(R.id.image_team_pick);
这是我的XML
<TableLayout
android:id="@+id/table_current_picks"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_gravity="center_vertical"
android:orientation="vertical"
android:layout_weight="1">
</TableLayout>