Hiii all, this may be a possible duplicate but I couldn't find solution for my problem.I need to limit the number of characters per line when displaying on the textview and display the remaining characters in the next line.I cannot set ems value and I also tried setting maxLength attribute in xml but it is not displaying the remaining characters,Can any one tell me how can I do it.
相关问题
- How can I create this custom Bottom Navigation on
- Bottom Navigation View gets Shrink Down
- How to make that the snackbar action button be sho
- Listening to outgoing sms not working android
- How to create Circular view on android wear?
相关文章
- android开发 怎么把图片放入drawable的文件夹下
- android上如何获取/storage/emulated/下的文件列表
- androidStudio有个箭头不认识
- SQLite不能创建表
- Windows - Android SDK manager not listing any plat
- Animate Recycler View grid when number of columns
- Why is the app closing suddenly without showing an
- Android OverlayItem.setMarker(): Change the marker
use
android:maxWidth="10dip"
to limit the size of the textview. With this limitation the next line (assume you usedsetSingleLine(false)
) will start right after the10dip
.Using
android:maxLength="50"
for example would limit your textview, but doesn't ensure that it breaks after X charactersSet these parameters of TextView:
Experiment with the value of
android:layout_width
to find the value that fits your needs.Use this code:
Five line with max length of 10 character.
use ConstraintLayout and android:layout_width="0dp". The text will adapt to the constraints
Use this
android:maxLength="10"
For more Information refer this site
Using
Replace the "size" with the size you prefer. For example,
100dip
.