Android - wyrownanie wysokosci w tabelce

0

Witam, mam prosta tabelke w xml

<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
    android:layout_width="match_parent"
    android:layout_height="match_parent">

    <TableLayout
        android:id="@+id/table"
        android:layout_height="match_parent"
        android:layout_width="match_parent"
        android:stretchColumns="*"
        android:shrinkColumns="3">
    </TableLayout>

</LinearLayout>

I kod:

        ArrayList<String> headers = new ArrayList<>();
        headers.add("TEKST");
        headers.add("TEKST");
        headers.add("TEKST");
        headers.add("NIECO DLUZSZY TEKST");

        for(int i = 0; i < headers.size(); i++) {
            TextView header = new TextView(getApplicationContext());
            header.setText(headers.get(i));
            header.setTextColor(Color.WHITE);
            header.setBackgroundColor(Color.rgb(24, 116, 205));
            header.setPadding(15, 15, 15, 15);
            header.setTextSize(20);

            headerRow.addView(header);
        }

Niestety jak widac wysokosc pozostalych komorek nie zwieksza sie do tej najwiekszej. Jak to poprawic?

https://sketch.io/render/sketch56bdb0f52a3e1.png

Pozdrawiam

0

Coś takiego powinno zadziałać:

LinearLayout.LayoutParams params = new LinearLayout.LayoutParams(
    LayoutParams.WRAP_CONTENT, LayoutParams.MATCH_PARENT);
params.weight = 1.0f;
header.setLayoutParams(params);

1 użytkowników online, w tym zalogowanych: 0, gości: 1