Как заставить некоторые столбцы textview в TableLayout быть не усеченными в 1 строку? - PullRequest
0 голосов
/ 26 марта 2019

Я хочу создать таблицу с 3 столбцами (3 TextViews) и чтобы первый столбец (0) получал все необходимое ему пространство (ширину), пока текст других столбцов (1,2) не будет обрезан ,
Я пытался использовать « stretchColumns », но это вызывает усечение другого текстового представления.
Это то, что я получаю сейчас, используя следующие XML:


enter image description here


Это мои объекты XML таблицы:

<TableLayout
            android:id="@+id/correctionsTable"
            android:layout_width="match_parent"
            android:layout_height="wrap_content"
            android:stretchColumns="0">

            <TableRow
                android:layout_width="wrap_content"
                android:layout_height="wrap_content">

                <TextView
                    android:layout_width="wrap_content"
                    android:layout_height="wrap_content"
                    android:fontFamily="sans-serif"
                    android:maxLines="1"
                    android:text="type"
                    android:textStyle="bold" />

                <TextView
                    android:layout_width="wrap_content"
                    android:layout_height="wrap_content"
                    android:fontFamily="sans-serif"
                    android:gravity="center"
                    android:maxLines="1"
                    android:text="time"
                    android:textStyle="bold" />

                <TextView
                    android:layout_width="wrap_content"
                    android:layout_height="wrap_content"
                    android:fontFamily="sans-serif"
                    android:gravity="right"
                    android:maxLines="1"
                    android:text="precent"
                    android:textStyle="bold" />
            </TableRow>


            <include layout="@layout/fragment_session_statistics_correction" />

            <include layout="@layout/fragment_session_statistics_correction" />

            <include layout="@layout/fragment_session_statistics_correction" />

        </TableLayout>


и внутренний XML каждой строки "gment_session_statistics_correction "имеет вид:

<TableRow xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
android:layout_width="match_parent"
android:layout_height="match_parent">

<TextView
    android:id="@+id/textViewType"
    android:layout_weight="0.6"
    android:width="0dp"
    android:layout_height="wrap_content"
    android:text="rtyrtyrdfg dfg df g dfg df gdf g df gdf g df gdf gdf g df gdf gdf ttrygdf gdf g df gdf gdf ttry sdfs  s s s ss ss s s s s" />

<TextView
    android:id="@+id/textViewTime"
    android:layout_height="wrap_content"
    android:layout_weight="0.2"
    android:width="0dp"
    android:maxLines="1"
    android:gravity="center"
    android:scrollHorizontally="true"
    android:text="T2extView" />

<TextView
    android:id="@+id/textViewPercent"
    android:layout_height="wrap_content"
    android:layout_weight="0.2"
    android:width="0dp"
    android:gravity="center"
    android:maxLines="1"
    android:text="TextView" />

</TableRow>

Как я могу заставить эти TextViews установить их минимальный размер так, чтобы текст отображался полностью в 1 строку.
* Примечание: строки (кроме заголовка) добавляются во время выполнения с другими строками.

...