2016-11-22 4 views
1

アイアイコンの位置を左に変更したいと思います。 EditText内のテキストを右に整列されるようにレイアウト内のショーパスワードアイコンの位置を変更する方法

inputype of edittext as textPassword

私は、アラビア語のアプリを開発しています。どのようにこれを行う上の任意のアイデア?

マイコード:

<android.support.design.widget.TextInputLayout 
    android:layout_width="match_parent" 
    android:layout_height="wrap_content"> 

    <EditText 
     android:id="@+id/txt_password" 
     android:layout_width="match_parent" 
     android:layout_height="34dp" 
     android:hint="@string/prompt_password" 
     android:imeActionLabel="@string/action_sign_in" 
     android:imeOptions="actionUnspecified" 
     android:inputType="textPassword" 
     android:maxLines="1" /> 

</android.support.design.widget.TextInputLayout> 
+0

を使用してください。 drawableleftを使用してアイコンを左に揃えます – Madhav

+0

@Madhavしかし、私はdrawTypeを使用していません。inputTypeをtextPasswordとして使用すると、目のアイコンが追加されます。 –

答えて

0

これを確認してください。

<android.support.design.widget.TextInputLayout 
android:layout_width="match_parent" 
android:layout_height="wrap_content" 
android:layout_gravity="center" 
android:textColor="@android:color/white" 
android:textColorHint="@color/loginHint"> 

<android.support.v7.widget.AppCompatEditText 
    android:layout_width="wrap_content" 
    android:layout_height="wrap_content" 
    android:imeOptions="actionNext" 
    android:inputType="textEmailAddress|textNoSuggestions" 
    android:minWidth="350dp" 
    android:drawableRight="@drawable/ic_store_white_48dp" 
    android:drawableStart="@drawable/ic_store_white_48dp" 
    android:textColor="@android:color/white" 
    android:textColorHint="@color/loginHint" 
    android:textCursorDrawable="@null" 
    app:backgroundTint="@android:color/white"/> 

+0

は、アンドロイドを使用しています。 .support.design.widget.TextInputLayoutそしてそのアイコンを自動的に追加します –

+0

アンドロイド:drawableRightをandroid:drawableLeftに変更しましたが、機能しますが、アイコンを使ってパスワードを表示できるようにする必要があると私は仮定しましたテキスト右? –

+0

今すぐご確認ください。それを正しいものにする。 –

1
<EditText 
    android:layout_width="match_parent" 
    android:layout_height="wrap_content" 
    android:inputType="textVisiblePassword" 
    android:text="Name" 
    android:drawableStart="@drawable/ic_search_in" 
    android:id="@+id/editText2"/> 
+0

しかし、どのように私はそれをクリックしたときにパスワードのテキストを表示するアイコンを設定するだろう –

1

右へのEditTextの重力を作成し、次のコード

<EditText 
android:id="@+id/inputSearch" 
android:layout_width="match_parent" 
android:layout_height="wrap_content" 
android:gravity="right" 
android:drawableLeft="@android:drawable/ic_menu_search"/> 
+0

それはdrawableLeftのおかげで動作しますが、私はandroid.support.design.widget.TextInputLayoutライブラリを使用していますその目のアイコンを自動的に追加する –

関連する問題