TableRow line division - Layout [closed]

1

I was looking over TableRow and developing a test app with this layout template and a question arose. I have a Table with 1 Line and 2 columns, whose situation is shown in the figure below. But in column 2 it is not completely filled by content, is it possible for me to "divide" this column like this and insert another textView below the one it already has to complete the content? Because then I would enter the temperature value below the writing "Temperature"

    
asked by anonymous 10.10.2017 / 06:07

1 answer

0

TableRow should be used within TableLayout, otherwise it behaves like a horizontal Linearlayout.

As TableRow a layout (extends LinearLayout) can contain any view, including another layout type.

So, to get the two TextViews one underneath the other, place them inside a LinearLayout in vertical orientation:

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

        <TableRow>
            <ImageView
                android:src="@drawable/ic_weathernow"/>
            <LinearLayout
                android:orientation="vertical">
                <TextView
                    android:layout_height="match_parent"
                    android:layout_width="wrap_content"
                    android:text="Temperatura"/>
                <TextView
                    android:layout_height="match_parent"
                    android:layout_width="wrap_content"
                    android:text="28º"
                    android:layout_gravity="center"/>
            </LinearLayout>
        </TableRow>
    </TableLayout>
...
    
10.10.2017 / 15:22