How to wrap long text as text on Android
In my application, I have a long text text view. I need a text wrap like in android phone-> contact-> (screen that no dialpad contact is wearing).
but in my application I get text wrapping like this in the picture:
I tried several ways to make it not meet my requirement. I don't need the "..." in the right corner of the text view. instead, I want to wrap the text like in the first picture (Android emulator-> contact-> phone). how to do it? please, help. Thanks in advance.
source to share
Alternatively, you can use the library's auto-resize support for TextViews
as per Android documentation .
How to use?
For API 26 and later:
<?xml version="1.0" encoding="utf-8"?>
<TextView
android:layout_width="match_parent"
android:layout_height="200dp"
android:autoSizeTextType="uniform" />
To support an earlier Android version, you can use:
<?xml version="1.0" encoding="utf-8"?>
<TextView
android:layout_width="match_parent"
android:layout_height="200dp"
app:autoSizeTextType="uniform" />
If you have an option that increases / decreases the size TextView
you can do:
For API 26 and later:
<?xml version="1.0" encoding="utf-8"?>
<TextView
android:layout_width="match_parent"
android:layout_height="200dp"
android:autoSizeTextType="uniform"
android:autoSizeMinTextSize="12sp"
android:autoSizeMaxTextSize="100sp"
android:autoSizeStepGranularity="2sp" />
For earlier versions:
<?xml version="1.0" encoding="utf-8"?>
<TextView
android:layout_width="match_parent"
android:layout_height="200dp"
app:autoSizeTextType="uniform"
app:autoSizeMinTextSize="12sp"
app:autoSizeMaxTextSize="100sp"
app:autoSizeStepGranularity="2sp" />
source to share