我设置了
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/