Tuesday, 15 September 2015

Making text in a text view show dots instead of coliding with another textview(Android) -



Making text in a text view show dots instead of coliding with another textview(Android) -

i have next problem:

http://imgur.com/ory1b2p

i have android application uses lists, custom list item, , textviews populated text.

how can create text have maximum 3 lines , not overlap right number(25)?

here code:

<?xml version="1.0" encoding="utf-8"?> <relativelayout android:layout_width="fill_parent" android:layout_height="fill_parent" xmlns:android="http://schemas.android.com/apk/res/android" android:id="@+id/linearlayout"> <imageview android:id="@+id/imageviewalertlist" android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_alignparentleft="true" android:src="@drawable/ellipse103"/> <textview android:id="@+id/textviewdistancelabel" android:layout_width="wrap_content" android:layout_height="wrap_content" android:gravity="bottom" android:hint="distance:" android:layout_torightof="@+id/imageviewalertlist" android:layout_alignbottom="@+id/imageviewalertlist" android:textappearance="?android:attr/textappearancemedium" /> <textview android:id="@+id/textviewdistancekmlistitem" android:layout_width="wrap_content" android:layout_height="wrap_content" android:gravity="bottom" android:hint="n/a" android:layout_torightof="@+id/textviewdistancelabel" android:layout_alignbottom="@+id/imageviewalertlist" android:textappearance="?android:attr/textappearancemedium" /> <linearlayout android:layout_width="wrap_content" android:layout_height="wrap_content" android:orientation="vertical" android:layout_torightof="@+id/imageviewalertlist" android:id="@+id/linearlayout2"> <textview android:id="@+id/textviewalerttimelistitem" android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_weight="0.20" android:hint="test minutes ago" android:textappearance="?android:attr/textappearancesmall" /> <textview android:id="@+id/textviewalertdescriptionlistitem" android:layout_width="wrap_content" android:layout_height="wrap_content" android:textappearance="?android:attr/textappearancesmall" android:ellipsize="@+id/textviewalertbusnumberlistitem" android:singleline="false"/> </linearlayout> <linearlayout android:id="@+id/id_iancu_1" android:layout_width="wrap_content" android:layout_height="wrap_content" android:orientation="vertical" android:layout_alignparentright="true" android:layout_marginright="20dp"> <textview android:id="@+id/textviewalertbusnumberlabel" android:layout_width="wrap_content" android:layout_height="wrap_content" android:hint="channel" android:textappearance="?android:attr/textappearancesmall" /> <textview android:id="@+id/textviewalertbusnumberlistitem" android:layout_width="wrap_content" android:layout_height="wrap_content" android:textappearance="?android:attr/textappearancelarge" /> </linearlayout> </relativelayout>

i want show dots if passes 3 lines.

thanks in advance!

when utilize weight attribute, set width 0dp instead wrap_content. prefer using whole numbers (eventhough don't know if makes difference). set maximum lines utilize maxlines attribute. dots use:

android:ellipsize="end"

android textview

No comments:

Post a Comment