As you can see here, I try to manage with weights.
<?xml version="1.0" encoding="utf-8"?>
<TableLayout
android:id="@+id/dialog_table_results"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:padding="20dp"
xmlns:android="http://schemas.android.com/apk/res/android">
<TableRow>
android:id="@+id/headerrow
>
<TextView
android:text=""
android:layout_weight="0.25"/>
<TextView
android:text="@string/choosing"
android:layout_weight="0.25"/>
<TextView
android:text="@string/matching"
android:layout_weight="0.25"/>
<TextView
android:text="@string/counting"
android:layout_weight="0.25"/>
</TableRow>
<TableRow>
android:id="@+id/subheaderrow
>
<TextView
android:text=""
android:layout_weight="0.28"
/>
<TextView
android:text="@string/trueanswer"
android:layout_weight="0.08"/>
<TextView
android:text="@string/falseanswer"
android:layout_weight="0.08"/>
<TextView
android:text="@string/halftrueanswer"
android:layout_weight="0.08"/>
<TextView
android:text="@string/trueanswer"
android:layout_weight="0.08"/>
<TextView
android:text="@string/falseanswer"
android:layout_weight="0.08"/>
<TextView
android:text="@string/halftrueanswer"
android:layout_weight="0.08"/>
<TextView
android:text="@string/trueanswer"
android:layout_weight="0.08"/>
<TextView
android:text="@string/falseanswer"
android:layout_weight="0.08"/>
<TextView
android:text="@string/halftrueanswer"
android:layout_weight="0.08"/>
</TableRow>
</TableLayout>
Each rows has 1 weight.
For first row, each column has 0.25 weight.
First column of first row is empty, again it must be 0.25 to align first row. Because there will be more row after those.
I added layout column attribute just like described here https://stackoverflow.com/a/10762446/6412889
For first row , between 0-3, for second, 0 to 10.
I deleted weight, tried with weights but did not change
I also added
android:layout_width="wrap_content"
android:layout_height="wrap_content"
or match parent of deleted, left only tablelayout width height but did not work. Also added
android:shrinkColumns="*"
android:stretchColumns="*"
but it made worse.
https://stackoverflow.com/a/14941587/6412889 this also did not work. It made top row good but second is still same. Also top is not good, the 4 columns must be equal.
Maybe using listview will be better?
When user clicks an icon, it brings a popup menu. When user clicks first one of it, a popup tablelayout will be shown. I dont know if listview can be suitable for this. With tablelayout it would be really easy. And also I don't need list click of listview. It is just for showing.