androidandroid-textinputlayoutandroid-gravity

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


Solution

  • 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>