I have this layout
<ScrollView>
<TextView android:id="@+id/textView" />
</ScrollView>
When I try to set a too long text, this Textview
doesn't show that.
//OnCreate
//...
TextView textView = (TextView) findViewById(R.id.textView);
textView.setText("..."); //Here is a text with more than 2500
//chars and at least have 10 \n char
//(it means has at least 10 paragraph)
How can do I show that text?
Edit One :
Even I set a background
to that TextView
and the TextView
does'nt show that background
you can set
android:maxLines="1"
android:ellipsize="end"
to your textview, so the text which long than your textview will be hide.
Because android:singleLine="true"
attribute has been deprecated, set the following attributes to your TextView:
android:ellipsize="end"
android:maxLines="1"
The TextView will then show only the text that can fit to your TextView, followed by an ellipsis ...
i dont know if this will help you but saw this on developer.android...
With Android 8.0 (API level 26) and higher, you can instruct a TextView to let the text size expand or contract automatically to fill its layout based on the TextView's characteristics and boundaries. This setting makes it easier to optimize the text size on different screens with dynamic content.
android:autoSizeTextType="uniform"
There are three ways you can set up the autosizing of TextView:
Default
Granularity
Preset Sizes
=================================================
readMore
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With