問(wèn)題描述
我的應(yīng)用程序使用 RTL 語(yǔ)言(從右到左).
My application uses RTL language (right to left).
當(dāng) EditText
字段獲得焦點(diǎn)時(shí),光標(biāo)出現(xiàn)在左側(cè),只有當(dāng)用戶開(kāi)始鍵入時(shí),光標(biāo)(和 RTL 文本)才會(huì)向右移動(dòng).當(dāng)用戶點(diǎn)擊回車(chē)"開(kāi)始換行時(shí),光標(biāo)再次向左移動(dòng).
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.
當(dāng)我使用 android:gravity="right"
時(shí),光標(biāo)正常(在右側(cè)),但當(dāng)用戶開(kāi)始鍵入時(shí),文本總是移動(dòng)到另一側(cè)(RTL 文本移動(dòng)左).
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).
任何想法如何將文本向右對(duì)齊并保持文本方向?
Any ideas how I can align text to the right AND keep the text direction?
推薦答案
它對(duì)我有用
<EditText
android:id="@+id/editText1"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:ellipsize="end"
android:gravity="right" />
橢圓尺寸
很重要
解決你的問(wèn)題
這篇關(guān)于如何在EditText中將光標(biāo)定位在右側(cè)的文章就介紹到這了,希望我們推薦的答案對(duì)大家有所幫助,也希望大家多多支持html5模板網(wǎng)!