Reputation:
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
How can I sort this out?
Upvotes: 0
Views: 1614
Reputation: 3195
try the following
android:ellipsize="end"
android:maxEms="15"
android:singleLine="true"
Upvotes: 2