問題描述
我的應用程序使用 RTL 語言(從右到左).
My application uses RTL language (right to left).
當 EditText
字段獲得焦點時,光標出現在左側,只有當用戶開始鍵入時,光標(和 RTL 文本)才會向右移動.當用戶點擊回車"開始換行時,光標再次向左移動.
When the EditText
field gets focus, the cursor appears on the left and only when the user starts to type, the cursor (and the RTL text) moves right.
When the user clicks "enter" to start a new line, the cursor moves to the left again.
當我使用 android:gravity="right"
時,光標正常(在右側),但當用戶開始鍵入時,文本總是移動到另一側(RTL 文本移動左).
When I use android:gravity="right"
, the cursor is OK (on the right) but as the user starts to type the text always moves to the the other side (RTL text moves left).
任何想法如何將文本向右對齊并保持文本方向?
Any ideas how I can align text to the right AND keep the text direction?
推薦答案
它對我有用
<EditText
android:id="@+id/editText1"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:ellipsize="end"
android:gravity="right" />
橢圓尺寸
很重要
解決你的問題
這篇關于如何在EditText中將光標定位在右側的文章就介紹到這了,希望我們推薦的答案對大家有所幫助,也希望大家多多支持html5模板網!