Skip to content Skip to sidebar Skip to footer

TextView Not Always Expanding To A Second Line In TableLayout

I have an app that is pulling information from a json file: { 'EVENTS': [ { 'what': ' TABLE-QUIZ', 'who': 'anyone', 'when': '31st Janua

Solution 1:

The problem is that you set TableLayout's width (parent's width) to wrap_content. Setting it to match_parent like this

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

makes When column go to the next line without being cut off.


Solution 2:

You need to view the full data means add this on Textview

android:singleLine="false" 

Hope this one will helps you.


Solution 3:

Change android:layout_weight to 1 and android:layout_width in all the TextViews to 0dp, so that layout_weight="1" property can work.

Hope this helps!


Solution 4:

I hope this helps

<?xml version="1.0" encoding="utf-8"?>
<TableLayout xmlns:android="http://schemas.android.com/apk/res/android"
    android:id="@+id/tableLayout1"
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    android:shrinkColumns="*"
    android:stretchColumns="*" >

    <TableRow
        android:id="@+id/tableRow1"
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:gravity="center_horizontal" >

        <TextView
            android:id="@+id/textView41"
            android:text="when"
            android:textStyle="bold" />

        <TextView
            android:id="@+id/textView42"
            android:gravity="center_horizontal"
            android:text="28°C" />

        <TextView
            android:id="@+id/textView43"
            android:gravity="center_horizontal"
            android:text="where" />

        <TextView
            android:id="@+id/textView44"
            android:gravity="center_horizontal"
            android:text="what" />

        <TextView
            android:id="@+id/textView44"
            android:gravity="center_horizontal"
            android:text="for who" />

    </TableRow>
</TableLayout>

Post a Comment for "TextView Not Always Expanding To A Second Line In TableLayout"