Christophe R.
Christophe R.

Reputation: 55

TextView in a ListView : the text overflowing the screen

I'm happy to be part of your community,

I'm seeking how to resolve this problem: The text from the TextView overflowing the screen... (From the ListView)

Look at this screenshot

Here you have my XML layout:

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

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

        <TableRow android:layout_width="wrap_content" android:layout_height="wrap_content">
            <ImageView android:layout_width="100dp" android:padding="8dp" android:src="@drawable/nophotoactualite" android:id="@+id/img" android:layout_height="wrap_content"></ImageView>
        </TableRow>

        <LinearLayout android:layout_marginTop="3dp" android:orientation="vertical" android:layout_width="wrap_content" android:layout_height="wrap_content" android:weightSum="1">
            <TextView android:id="@+id/item_title" android:textSize="20dp" android:textStyle="bold" android:text="TextView" android:textColor="#000000" android:layout_height="wrap_content" android:layout_width="fill_parent"></TextView>
            <TextView android:text="TextView" android:id="@+id/item_subtitle" android:textSize="12dp" android:textColor="#999999" android:layout_width="fill_parent" android:layout_height="wrap_content"></TextView>
        </LinearLayout>

    </TableRow>

  </TableLayout>

</LinearLayout>

EDIT: I want the text which begins to overflow goes to the next line instead.

Thank you by advance for your help, Regards.

Upvotes: 1

Views: 594

Answers (2)

ilzarka
ilzarka

Reputation: 26

I think, that your second TableRow is closing in the wrong place. Just try close it after you close LinearLayout.

P.S. For which purposes you create TableRow in TableRow ? It's working greate with one:

    <TableRow android:layout_width="wrap_content" android:layout_height="wrap_content">
        <ImageView android:layout_width="100dp" android:padding="8dp" android:src="@drawable/icon" android:id="@+id/img" android:layout_height="wrap_content"></ImageView>


        <LinearLayout android:layout_marginTop="3dp" android:orientation="vertical" android:layout_width="wrap_content" android:layout_height="wrap_content" android:weightSum="1">
            <TextView 
                android:id="@+id/item_title" 
                android:textSize="20dp" 
                android:textStyle="bold" 
                android:text="TextView" 
                android:textColor="#000000" 
                android:layout_height="wrap_content" 
                android:layout_width="fill_parent"
                />
            <TextView 
                android:id="@+id/item_subtitle" 
                android:textSize="12dp" 
                android:textColor="#999999" 
                android:layout_width="fill_parent" 
                android:layout_height="wrap_content"
                android:text="TextViasd asd asd asd asd as dasasdasd asdasdew" 
                />
        </LinearLayout>
    </TableRow>

Upvotes: 1

you can use the TextFreeze property of textview or set the SingleLine property to false

Upvotes: 0

Related Questions