如何在textview中自动换行,以免偶尔打断单词

时间:2018-08-09 16:16:45

标签: android

下面有这段代码用于处理我的问题的文本视图:

Installing business network. This may take a minute...
Error: Error trying install business network. Error: No valid responses from any peers.
Response from attempted peer comms was an error: Error: 14 UNAVAILABLE: Connect Failed
Command failed

但是我发现了一些东西。有时,如果单词到达末尾而又不合适,则与其将单词向下移动到下一行,不如将其分解为-。

    <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"/>

为了能够自动换行,我需要在上面的xml中包含什么?

2 个答案:

答案 0 :(得分:0)

尝试

android:breakStrategy="simple"

答案 1 :(得分:0)

您可以通过在XML中使用<% Set myMail=CreateObject("CDO.Message") myMail.BodyPart.Charset = "UTF-8" myMail.Subject= Your Message Subject myMail.From= "anotheremail@anotherdomain.com" myMail.To=Receiver Email Address myMail.CreateMHTMLBody "Test Email Subject" myMail.Configuration.Fields.Item ("http://schemas.microsoft.com/cdo/configuration/sendusing")=2 myMail.Configuration.Fields.Item ("http://schemas.microsoft.com/cdo/configuration/smtpserver")= SMTP_SERVER myMail.Configuration.Fields.Item ("http://schemas.microsoft.com/cdo/configuration/smtpserverport")=25 myMail.Configuration.Fields.Item ("http://schemas.microsoft.com/cdo/configuration/smtpauthenticate") = 1 myMail.Configuration.Fields.Item ("http://schemas.microsoft.com/cdo/configuration/sendusername")=SMTP_Email_Username myMail.Configuration.Fields.Item ("http://schemas.microsoft.com/cdo/configuration/sendpassword")=Smtp_Email_Password myMail.Configuration.Fields.Update myMail.Send set myMail=nothing %>或动态设置属性来实现

共有三种breakStrategy类型可用
1)简单,
2)high_quality,
3)平衡

您可以使用以上任何一种为您提供不同的换行策略,

breakStrategy

也可以在Google上找到一张图片,以图形方式向您解释 https://t1.daumcdn.net/cfile/tistory/267FFD3E57BADA6121