android - Textview limit 140 Characters not working -


i know question asked multiple times not able solve problem available solutions.

i applied solutions available on other stack overflow threads.

requirements :

if string length more 140 show 140 characters , @ last add ".." @ last. if string less 140 characters no need append ".." @ last.

what have tried:

        <textview             android:id="@+id/tvissuebody"             android:layout_width="wrap_content"             android:layout_height="wrap_content"             android:ellipsize="end"             android:maxlength="140"             android:paddingbottom="5dp"             android:paddingleft="@dimen/activity_horizontal_margin"             android:text="small text"             android:textappearance="?android:attr/textappearancesmall"             android:textsize="@dimen/detail_text_size"/> 

i have tried above code not working , tried other properties mixture not working.

shall have str.substring(0,141) option? there no way limit 140 characters using textview property?

thanks in advanced. appreciated.

there's no way work want built in textview. first off, textview not allow add more maxlength characters. if try add 200 characters, last 60 dropped. means 141 won't work if want keep data. , elipsize doesn't ellipsize want it- ellipsizes needs in order fit text on screen. can't force after given length.

what want need custom view or subclass of textview, can override ondraw draw different string set text (a hand ellipsized version of it).


Comments