【问题标题】:how to align text width in a Textview?如何在Textview中对齐文本宽度?
【发布时间】:2017-10-26 09:53:12
【问题描述】:

我想像这样对齐我的 TextView 中的文本

而我现在textView 的样子就像

不使用Webview如何实现text layout

【问题讨论】:

标签: android android-layout text textview android-xml


【解决方案1】:

Android O 中的TextView 本身提供了完整的理由(新的排版对齐方式)。

你只需要这样做,

textView.setJustificationMode(JUSTIFICATION_MODE_INTER_WORD);
default is JUSTIFICATION_MODE_NONE

【讨论】:

    【解决方案2】:

    你可以使用:

    https://github.com/bluejamesbond/TextJustify-Android

    安装只需添加到您的 build.gradle

    dependencies {
        compile 'com.github.bluejamesbond:textjustify-android:2.1.6'
    }
    

    使用:https://github.com/Saleh-Hassan/RTL-TextJustify-Android

    例子:

    【讨论】:

      猜你喜欢
      • 2020-09-06
      • 2014-02-06
      • 2017-04-17
      • 2014-11-03
      • 2013-02-11
      • 2012-08-16
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多