I have a textview to show a result from a process, but when the result too long (more than my textview width), it will automatically append a dash like in blue circle (in picture). How to remove it without make it scrollable, just remove the dash?
Asked
Active
Viewed 2,077 times
0
-
1You can replace dash with blank space using replace function,like String str="your result"; str=str.replace("-",""); – Pravin Fofariya Jun 10 '17 at 07:13
-
1Or use `textView.setText(editText.getText().toString().replace("-",""));` – Zoe Jun 10 '17 at 07:33
-
No, not from the code I think. My code literally be like textView.setText("HereIsMyLongStringWithoutSpace"). So the problem is on the layout or XML (maybe). – nichkotama Jun 10 '17 at 07:41
-
Share xml and java code. – Ahmad Aghazadeh Jun 10 '17 at 08:07
-
Possible duplicate of [Hyphenation in Android](https://stackoverflow.com/questions/4454911/hyphenation-in-android) – 2hamed Jun 10 '17 at 08:08
4 Answers
1
If you are using api 23 or above , you can use android:breakStrategy
and as value BREAK_STRATEGY_SIMPLE.

Emin Ayar
- 1,104
- 9
- 13
1
This might not be proper solution of your problem but it will help you to achieve this.
Use EditTextView instead of TextView and set android:focusableInTouchMode="false",android:focusable="false"
,then EditTextView will work like TextView and it will not show dash(-) symble

Ajeet Choudhary
- 1,969
- 1
- 17
- 41
1
Add this on your TextView android:hyphenationFrequency="none", this will remove the hyphen
0
It is now possible with soft hyphen -> use \u00AD in strings, e.g.:
<string name="einzelfahrt_name">Einzelfahrrad\u00ADkarte</string>
Also, in your TextView, you have to add:
android:hyphenationFrequency="full"

APTower
- 343
- 2
- 8