[英]How to word wrap in textview so it doesn't break words up occaisionally
我下面的这段代码处理了我的问题的文本视图:
<TextView
android:id="@+id/textquestion"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_centerHorizontal="true"
android:layout_margin="5dp"
android:gravity="center"
android:text="Your Question Display Hear....Your Question Display Hear....Your Question Display Hear....Your Question Display Hear...."
android:textColor="@color/white"
android:textSize="20sp"
android:textStyle="bold"
android:scrollHorizontally="false"/>
但是,我注意到了一些东西。 有时,如果单词到达末尾且不合适,则不将单词向下移动到下一行,而是使用-将单词分解。
This is an example test to show that th-
is text breaks as you can see and not
move the word down to the next line.
为了能够自动换行,我需要在上面的xml中包含什么?
试试看
android:breakStrategy="simple"
您可以通过在XML中使用breakStrategy
或动态设置属性来实现
共有三种breakStrategy
类型可用的策略
1)简单
2)高品质,
3)平衡
您可以使用以上任何一种提供不同的换行策略的方法,
android:breakStrategy="high_quality"
另外,在Google上找到一张图片,以图形方式对您进行说明https://t1.daumcdn.net/cfile/tistory/267FFD3E57BADA6121
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.