android - 在 Android Studio : Text alignment 中需要帮助

标签 android android-layout

我设置了 android:gravity="右" 将我的文字右对齐。 但是,当字符串长度超过空格时,后面的文字就看不到了。

如何解决这个问题,让之前的条目向左移动?

看来我的代码的问题来自 EditText.append(),当我附加来自 OnClickListener 的新输入时,文本的行为方式与键盘输入的方式相同。

你能指导我如何解决吗?对不起,我是 Android 新手

<EditText
    android:id="@+id/equation"
    android:layout_width="wrap_content"
    android:layout_height="wrap_content"
    android:layout_marginEnd="16dp"
    android:layout_marginLeft="16dp"
    android:layout_marginRight="16dp"
    android:layout_marginStart="16dp"
    android:layout_marginTop="40dp"
    android:ems="10"
    android:focusable="false"
    android:focusableInTouchMode="false"
    android:inputType="numberSigned|numberDecimal"
    app:layout_constraintLeft_toLeftOf="parent"
    app:layout_constraintRight_toRightOf="parent"
    app:layout_constraintTop_toTopOf="parent"
    android:clickable="false"
    android:gravity="right"
    android:layout_gravity="end"/>

//图片

编辑文本小部件右对齐。

当字符串长度超过空格时,新条目就看不到了。

如何修改,让旧条目向左移动,新条目继续出现在编辑文本小部件的右端?

最佳答案

只需将此属性添加到您的 EditText

android:layout_alignParentRight="true"

此属性支持所有安卓版本。虽然@pail kanti 也对,但 android:textDirection="anyRtl" 支持 API 级别 17 及以上

谢谢。

关于android - 在 Android Studio : Text alignment 中需要帮助,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/41648506/

相关文章:

android - 像 MxPlayer 一样增加 ExoPlayer 2 的亮度

java - setSupportActionBar(工具栏工具栏) 在我的 Material 项目中不起作用

安卓布局缩放

android - 如何检测 Android 中 TextView 的重叠和重置位置?

Android 如何使用 Environment.getExternalStorageDirectory()

android - 是否可以在 Android 浏览器中进行 HTML5 拖放操作?

javascript - 如何在 TabNavigator 上显示图标以响应 native

java - 我可以在运行时将字符串数组保存到 strings.xml 吗?

android - 在 ScrollView 的 LinearLayout 中被遮挡的 subview

Android 布局 - 左边是图片,右边是 3 个 TextView