theblitz
theblitz

Reputation: 6881

Getting TextView to wrap

I know this question has been asked a number of times but I still can't seem to get this to work. I have tried all sorts of combinations and it just refuses to wrap to 2 lines.

This is what it is now:

    <TextView
        android:id="@+id/doctor_details_clinic_name"
        android:layout_width="fill_parent"
        android:layout_height="wrap_content"
        android:paddingRight="3dip"
        android:textSize="12sp"
        android:maxLines="1"
        android:layout_gravity="right"
        android:gravity="right"
        android:scrollHorizontally="false"
        android:singleLine="false"
        android:ellipsize="none"
        />

I've tried make the width 0dip and all other things suggested but to no accord.

Upvotes: 1

Views: 189

Answers (1)

karn
karn

Reputation: 6033

First of all you should set Max lines to 2 instead of 1. Something like this will work:

    <TextView
        android:id="@+id/myText"
        android:layout_width="fill_parent"
        android:layout_height="wrap_content"
        android:maxLines="2"
        android:ellipsize="end"
        android:text="this is the most interesting use of text view I have seen so far,this is the most interesting use of text view I have ever seen so far,this is the most interesting use of text view I have ever seen so far this is the most interesting use of text view I have ever seen so far"/>

Upvotes: 1

Related Questions