I am using Android Studio.I want to use "View More" after some letters in a textview. I have searched for it and it shows how to add "View More" after a specific number of lines but I want to add it after a specific number of letters. Can anybody suggest what should I do?
Asked
Active
Viewed 54 times
-1
-
Just out of curiosity what is the purpose of doing that? Is it some kind of game where the person tries to guess what the word is? – Glenn Werner Mar 31 '16 at 03:46
-
1Try this it might help http://stackoverflow.com/questions/10748796/android-how-to-limit-width-of-textview-and-add-three-dots-at-the-end-of-text – Raghavendra Mar 31 '16 at 04:02
1 Answers
0
As far as I understand your problem
Suppose you have a String
String name="Rajdev Stack overflow"
name has 21 characters/letters(including spaces).
If you want to show only upto 10 charchters and then view more, you can trim this String upto first 10 characters.
String trimmedName = name.substring(0, Math.min(name.length(), 10));
Now trimmedName contains only upto 10 characters. Now you can do:
trimmedName+"... view more";
so the user will see 10 characters and then view more
Rajdev Sta... view more

The Bat
- 1,085
- 1
- 13
- 31