Как установить высоту и ширину ячейки таблицы на android? - PullRequest
0 голосов
/ 26 мая 2020

у меня есть макет таблицы с двумя столбцами, в котором у меня есть несколько строк редактирования текста. Проблема в том, что когда я набираю более трех строк в ячейке, размер ячеек полностью изменяется, и первый столбец больше не виден. макет - это тип формы, например: имя: _____, адрес: _____. Макет:

<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
    android:layout_width="match_parent"
    android:layout_height="match_parent">

    <ScrollView
        android:layout_width="match_parent"
        android:layout_height="match_parent">

        <TableLayout
            android:layout_width="match_parent"
            android:layout_height="wrap_content"
            android:layout_margin="10dp">

            <TableRow>

                <TextView
                    android:layout_width="match_parent"
                    android:layout_height="wrap_content"
                    android:text="@string/documentType1"
                    android:layout_weight="30"/>

                <Spinner
                    android:id="@+id/spnDocumentType1"
                    android:layout_width="match_parent"
                    android:layout_height="wrap_content"
                    android:layout_weight="70"
                    android:backgroundTint="@color/black"/>

            </TableRow>

            <TableRow>

                <TextView
                    android:layout_width="match_parent"
                    android:layout_height="wrap_content"
                    android:text="@string/document1"
                    android:layout_weight="30"/>
                <EditText
                    android:id="@+id/edtDocument1"
                    android:layout_width="match_parent"
                    android:layout_height="wrap_content"
                    android:inputType="textNoSuggestions"
                    android:hint="*"
                    android:textColorHint="@color/red"
                    android:layout_weight="60"/>

            </TableRow>

            <TableRow>

                <TextView
                    android:layout_width="match_parent"
                    android:layout_height="wrap_content"
                    android:text="@string/documentType2"
                    android:layout_weight="30"/>

                <Spinner
                    android:id="@+id/spnDocumentType2"
                    android:layout_width="match_parent"
                    android:layout_height="wrap_content"
                    android:layout_weight="70"
                    android:backgroundTint="@color/black"/>

            </TableRow>

            <TableRow>

                <TextView
                    android:layout_width="match_parent"
                    android:layout_height="wrap_content"
                    android:text="@string/document2"
                    android:layout_weight="30"/>

                <EditText
                    android:id="@+id/edtDocument2"
                    android:layout_width="match_parent"
                    android:layout_height="wrap_content"
                    android:layout_weight="60"/>

            </TableRow>

            <TableRow>

                <TextView
                    android:layout_width="match_parent"
                    android:layout_height="wrap_content"
                    android:text="@string/nickname"
                    android:layout_weight="30"/>

                <EditText
                    android:id="@+id/edtNickname"
                    android:layout_width="match_parent"
                    android:layout_height="wrap_content"
                    android:hint="*"
                    android:textColorHint="@color/red"
                    android:layout_weight="70"/>

            </TableRow>

            <TableRow>

                <TextView
                    android:layout_width="match_parent"
                    android:layout_height="wrap_content"
                    android:text="@string/name1"
                    android:layout_weight="30"/>

                <EditText
                    android:id="@+id/edtName1"
                    android:layout_width="match_parent"
                    android:layout_height="wrap_content"
                    android:hint="*"
                    android:textColorHint="@color/red"
                    android:layout_weight="70"/>
            </TableRow>

            <TableRow>

                <TextView
                    android:layout_width="match_parent"
                    android:layout_height="wrap_content"
                    android:text="@string/name2"
                    android:layout_weight="30"/>

                <EditText
                    android:id="@+id/edtName2"
                    android:layout_width="match_parent"
                    android:layout_height="wrap_content"
                    android:layout_weight="70"/>
            </TableRow>

            <TableRow>

                <TextView
                    android:layout_width="match_parent"
                    android:layout_height="wrap_content"
                    android:text="@string/lastname1"
                    android:layout_weight="30"/>

                <EditText
                    android:id="@+id/edtlastname1"
                    android:layout_width="match_parent"
                    android:layout_height="wrap_content"
                    android:hint="*"
                    android:textColorHint="@color/red"
                    android:layout_weight="70"/>
            </TableRow>

            <TableRow>

                <TextView
                    android:layout_width="match_parent"
                    android:layout_height="wrap_content"
                    android:text="@string/lastname2"
                    android:layout_weight="30"/>

                <EditText
                    android:id="@+id/edtlastname2"
                    android:layout_width="match_parent"
                    android:layout_height="wrap_content"
                    android:layout_weight="70"/>
            </TableRow>

            <TableRow>

                <TextView
                    android:layout_width="match_parent"
                    android:layout_height="wrap_content"
                    android:text="@string/cellphone"
                    android:layout_weight="30"/>

                <EditText
                    android:id="@+id/edtCellphone"
                    android:layout_width="match_parent"
                    android:layout_height="wrap_content"
                    android:layout_weight="70"
                    android:hint="*"
                    android:textColorHint="@color/red"
                    android:inputType="phone"/>
            </TableRow>

            <TableRow>

                <TextView
                    android:layout_width="match_parent"
                    android:layout_height="wrap_content"
                    android:text="@string/email"
                    android:layout_weight="30"/>

                <EditText
                    android:id="@+id/edtEmail"
                    android:layout_width="match_parent"
                    android:layout_height="wrap_content"
                    android:layout_weight="70"
                    android:inputType="textEmailAddress"/>
            </TableRow>

            <TableRow>

                <TextView
                    android:layout_width="match_parent"
                    android:layout_height="wrap_content"
                    android:text="@string/address"
                    android:layout_weight="30"/>

                <EditText
                    android:id="@+id/edtAddress"
                    android:layout_width="match_parent"
                    android:layout_height="wrap_content"
                    android:hint="*"
                    android:textColorHint="@color/red"
                    android:layout_weight="70"/>
            </TableRow>

            <TableRow>

                <TextView
                    android:layout_width="match_parent"
                    android:layout_height="wrap_content"
                    android:text="Ciudad"
                    android:layout_weight="30"/>

                <Spinner
                    android:id="@+id/spnCity"
                    android:layout_width="match_parent"
                    android:layout_height="wrap_content"
                    android:layout_weight="70"
                    android:backgroundTint="@color/black"/>

            </TableRow>

            <TableRow>

                <Button
                    android:id="@+id/btnGetAddress"
                    android:layout_width="wrap_content"
                    android:layout_height="wrap_content"
                    android:text="@string/getAddress"
                    android:layout_gravity="left"
                    android:layout_column="1" />
            </TableRow>

            <TableRow>

                <TextView
                    android:layout_width="match_parent"
                    android:layout_height="wrap_content"
                    android:text="@string/economic_activity"
                    android:layout_weight="30"/>

                <Spinner
                    android:id="@+id/spnEconomicActivity"
                    android:layout_width="match_parent"
                    android:layout_height="wrap_content"
                    android:layout_weight="70"
                    android:backgroundTint="@color/black"/>

            </TableRow>

            <TableRow>

                <TextView
                    android:layout_width="match_parent"
                    android:layout_height="wrap_content"
                    android:text="@string/comments"
                    android:layout_weight="30"/>

                <EditText
                    android:id="@+id/edtComments"
                    android:layout_width="match_parent"
                    android:layout_height="wrap_content"
                    android:lines="5"
                    android:layout_weight="70"/>
            </TableRow>

            <TableRow>

                <Button
                    android:id="@+id/btnSaveCustomer"
                    android:layout_width="match_parent"
                    android:layout_height="wrap_content"
                    style="@style/styleButtonSave"
                    android:text="@string/save_customer"
                    android:layout_weight="100"
                    android:layout_marginBottom="20dp"/>

            </TableRow>

            <TableRow>

                <TextView
                    android:layout_width="match_parent"
                    android:layout_height="wrap_content"
                    android:text="TryController"
                    style="@style/styleTextviewInvisible"
                    android:layout_marginTop="10dp"/>

            </TableRow>

        </TableLayout>

    </ScrollView>

</LinearLayout>
...