user6092898
user6092898

Reputation:

Setting ellipse size property with max length to a textview doesn't show dots at the end

I have got two textviews that are aligned horizontally within relative layout.

Im limiting the max length of first textview to 15 and if it is more than 15, i wanna set ellipse size property to end

<RelativeLayout
            android:id="@+id/header"
            android:layout_width="fill_parent"
            android:layout_height="wrap_content"
            android:layout_alignParentTop="true"
            android:layout_marginLeft="3.0dip"
            android:layout_marginRight="3.0dip"
            android:layout_marginTop="5.0dip"
            android:background="@color/purple"
            android:padding="10.0dip"
            android:weightSum="10.0">

            <TextView
                android:id="@+id/compName"
                android:layout_width="wrap_content"
                android:layout_height="wrap_content"
                android:layout_alignParentLeft="true"
                android:ellipsize="end"
                android:singleLine="true"
                android:text="Form I Submission"
                android:textColor="@android:color/white"
                android:textStyle="bold"
                android:focusable="true"
                android:maxLength="14"
                android:focusableInTouchMode="true"/>

            <TextView
                android:id="@+id/compStatus"
                android:layout_width="wrap_content"
                android:layout_height="wrap_content"
                android:layout_alignParentRight="true"
                android:ellipsize="marquee"
                android:singleLine="true"
                android:text="Inprogress"
                android:textColor="@android:color/white"
                android:textStyle="bold" />
        </RelativeLayout>

The problem is

  1. The three dots at the are not visible when I use the above code
  2. If I remove max length property, dots are visible but still it overlaps the second textview.

How can I sort this out?

Upvotes: 0

Views: 1614

Answers (1)

mdDroid
mdDroid

Reputation: 3195

try the following

android:ellipsize="end" 
android:maxEms="15" 
android:singleLine="true" 

Upvotes: 2

Related Questions