android - 如何在 android 的 textview 中对齐文本并正确对齐

标签 android textview alignment

我在 xml 中有一个 TextView,但是我在 java 中给 TextView 值,同时显示它没有正确对齐。请问你能给出解决方案。

Xml 中,我给出的值意味着它显示正确,但在 java 中,我给出的值没有以正确的方式显示。我想证明文本的合理性

    <TextView 
    android:text="" android:id="@+id/result"
    android:layout_marginTop="13dp"
    android:layout_width="match_parent" 
    android:layout_height="match_parent" 
    android:layout_gravity="left|center|right" 
    android:gravity="left|center|right" 
    android:textStyle="bold" 
    android:textAlignment="center" 
    android:layout_marginRight="5dp" 
    android:layout_marginLeft="5dp"
    android:textSize="15dp" />

最佳答案

Android 0 支持 TextView 对齐。请点击以下链接

您还可以使用以下库进行文本对齐。

希望对你有帮助

关于android - 如何在 android 的 textview 中对齐文本并正确对齐,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/48900837/

相关文章:

python - Pandas dataframe.to_csv 文件行彼此不对齐

java - 在 Windows 中的 Android 模拟器中哪里可以找到创建的文件

android - 错误 aapt : Attribute "font" already defined with incompatible format. 此处定义的原始属性

android - 强制用户在对话框中选择选项

Android 视频不会在 webview 中恢复

android - 使用 Spinner 选定项填充 TextView - Android

memory - 数组未跨越 256 字节边界

android - 如何用空字符串消除 textview 的边距?

android - 如何在发生意外崩溃时保存 Activity 数据

ios - UITextField 填充