2012-07-29 101 views
1

我正在爲RTL語言環境開發一個應用程序。我有一個問題在右側的AutoCompleteTextView中顯示提示。但字符串顯示在右側。但是,如果我添加重力=右,則提示字符串顯示在右側,但AutoCompleteTextView上的字符串顯示在左側。我不知道如何解決這個問題。在右側的EditView中顯示文本

<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" 
android:layout_width="match_parent" 
android:layout_height="match_parent" 
android:orientation="vertical" 
android:padding="10dip" > 

<TextView 
    android:id="@+id/supplierNameTV" 
    android:layout_width="wrap_content" 
    android:layout_height="wrap_content" 
    android:text="@string/supplierNameTV" 
    android:textColor="#FFFFFF" 
    android:layout_gravity="right"/> 

<AutoCompleteTextView 
    android:id="@+id/supplierName_CB" 
    android:layout_width="fill_parent" 
    android:layout_height="wrap_content" 
    android:hint="@string/supplierNameTV"/> 
+1

無法理解你在說什麼! – AAnkit 2012-07-29 09:29:22

+0

您是否在AutoCompleteTextView上嘗試過singleLine =「true」和ellipsize =「end」? – Slickelito 2012-07-29 09:45:08

+0

@ Ankit,哪一部分你不明白。 – ZAJ 2012-07-29 09:51:39

回答

0

你想要的東西,像下面的圖片,讓我知道究竟如何,你希望它是什麼樣子,找到下面的圖片代碼...

<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" 
android:layout_width="match_parent" 
android:layout_height="match_parent" 
android:orientation="vertical" 
android:padding="10dip" android:gravity="right"> 

<TextView 
    android:id="@+id/supplierNameTV" 
    android:layout_width="wrap_content" 
    android:layout_height="wrap_content" 
    android:text="asdbakdsn" 
    android:textColor="#FFFFFF" 
    android:layout_gravity="right"/> 

<AutoCompleteTextView 
    android:id="@+id/supplierName_CB" 
    android:layout_width="fill_parent" 
    android:layout_height="wrap_content" 
    android:gravity="right" 
    android:hint="adsas"/> 
</LinearLayout> 
+0

不同之處在於你正在鍵入英文字符,替換爲波斯/波斯文本並添加一個提示也是。然後加載它和你會看到我 意思。你現在所做的是增加重力=右,這顯示了正確的文字。但在我的情況下,當我添加重力=正確的提示字符串顯示在右側,但是當我從自動填充小部件字符串顯示在左邊選擇一個字符串。然後當我刪除重力=右,提示顯示在左邊,但我選擇的自動完成字符串顯示在right.hope我自己清除 – ZAJ 2012-07-29 10:15:03

+0

我試過你的代碼,但它沒有奏效。我的意思是提示文本顯示在自動完成窗口小部件的右側,但是當我從自動完成中選擇一個名稱時,名稱左對齊,而不是右對齊,就像顯示提示字符串一樣。 – ZAJ 2012-07-30 04:15:15