user4813855
user4813855

Reputation:

Android - change position floating label (Bottom floating label) of TextInputLayout?

Can I change position floting label (Bottom floating lable) of TextInputLayout. I need to set right position for bellow floating label.

enter image description here

Upvotes: 1

Views: 1380

Answers (2)

Saeed Sharman
Saeed Sharman

Reputation: 785

Gravity property will come in handy in this case.

android:gravity="right"

Upvotes: 0

user4813855
user4813855

Reputation:

I solve my problem,here is my xml :

<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
    android:layout_width="fill_parent"
    android:layout_height="match_parent"
    android:layout_marginTop="?attr/actionBarSize"
    android:gravity="right"
    android:orientation="vertical"
    android:paddingLeft="20dp"
    android:paddingRight="20dp"
    android:paddingTop="60dp">

    <android.support.design.widget.TextInputLayout
        android:id="@+id/input_layout_name"
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:layout_gravity="right"
        android:gravity="right"
        android:layoutDirection="rtl"
        android:textDirection="rtl">

        <EditText
            android:id="@+id/input_name"
            android:layout_width="match_parent"
            android:layout_height="wrap_content"
            android:layout_gravity="right"
            android:gravity="right"
            android:hint="@string/hint_name"
            android:layoutDirection="rtl"
            android:singleLine="true"
            android:textDirection="rtl" />
    </android.support.design.widget.TextInputLayout>

    <android.support.design.widget.TextInputLayout
        android:id="@+id/input_layout_email"
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:layout_gravity="right"
        android:gravity="right"
        android:layoutDirection="rtl">

        <EditText
            android:id="@+id/input_email"
            android:layout_width="match_parent"
            android:layout_height="wrap_content"
            android:layout_gravity="right"
            android:gravity="right"
            android:hint="@string/hint_email"
            android:inputType="textEmailAddress"
            android:textAlignment="inherit" />
    </android.support.design.widget.TextInputLayout>

    <android.support.design.widget.TextInputLayout
        android:id="@+id/input_layout_password"
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:layout_gravity="right"
        android:gravity="right"
        android:layoutDirection="rtl">

        <EditText
            android:id="@+id/input_password"
            android:layout_width="match_parent"
            android:layout_height="wrap_content"
            android:layout_gravity="right"
            android:gravity="right"
            android:hint="@string/hint_password"
            android:inputType="textPassword"
            android:textAlignment="inherit" />
    </android.support.design.widget.TextInputLayout>

    <Button
        android:id="@+id/btn_signup"
        android:layout_width="fill_parent"
        android:layout_height="wrap_content"
        android:layout_marginTop="40dp"
        android:background="@color/colorPrimary"
        android:text="@string/btn_sign_up"
        android:textColor="@android:color/white" />

</LinearLayout>

Upvotes: 1

Related Questions