Академический Документы
Профессиональный Документы
Культура Документы
Stack Overflow
log in
android
Possible Duplicate:
Limit text length of EditText in Android
I am a textView on Activity, which is being displayed as per the parameter it is receiving from the JSON response, I need to restrict it to 12 characters
only.
<TextView
android:id="@+id/textViewName"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_below="@+id/includeheadersetting"
android:layout_marginLeft="20dp"
android:layout_marginTop="20dp"
android:gravity="center"
android:text="Name"
android:textColor="#000000"
android:textStyle="bold" />
share
user1737894
Dipak Keshariya
14.4k 9 50 102
Asked
Oct 29 '12 at 11:04
Edited
Oct 29 '12 at 11:14
marked as duplicate by Dharmendra, RivieraKid, BNL, Ted Hopp, Ahmad Oct 29 '12 at 15:10
This question has been asked before and already has an answer. If those answers do not fully address your question, please ask a new question.
5 Answers
25
Order By
Votes
using this property "..." will be added end of the text like
"Hello How are ..." instead of "Hello How are you?"
share
Answered
Oct 29 '12 at 11:07
Edited
Oct 29 '12 at 11:13
line 1: "hello how are" line 2 :"you" instaed of hello how are you Prasad Oct 15 '14 at 13:04
add a comment
share
Answered
Oct 29 '12 at 11:09
Dipak Keshariya
14.4k 9 50 102
Edited
Oct 29 '12 at 11:14
android:ellipsize="end" add a "..." not "marequee". stackoverflow.com/a/20511174/2469427 GeneralKimi Dec 18 '14 at 8:56
add a comment
share
Answered
Oct 29 '12 at 11:06
<TextView
android:id="@+id/textViewName"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_below="@+id/includeheadersetting"
android:layout_marginLeft="20dp"
android:layout_marginTop="20dp"
android:gravity="center"
android:text="Name"
android:textColor="#000000"
android:textStyle="bold"
android:maxLength="12" />
share
Answered
Oct 29 '12 at 11:07
whatever the limit you want you can replace that like instead of 12 can give 14 or whatever length you want.
share
Answered
Oct 29 '12 at 11:32
meta chat tour help blog privacy policy legal contact us full site
Download the Stack Exchange Android app
2016 Stack Exchange, Inc