Reposition Floating Text TextInputLayout

Problem

The text of the floating label appears above the edge of the EditText field. How can this be raised above a predetermined level?

My code is:

<android.support.design.widget.TextInputLayout
    android:id="@+id/input_layout_usernameL"
    android:theme="@style/MyTextInputLayout"
    android:layout_width="match_parent"
    android:layout_height="wrap_content">

    <EditText
        android:id="@+id/etUsername"
        android:layout_width="fill_parent"
        android:layout_height="wrap_content"
        android:layout_marginBottom="10dp"
        android:background="#ffffff"
        android:hint="Username"
        android:padding="10dp"/>


</android.support.design.widget.TextInputLayout>
+4
source share
3 answers

What can I do due to add-on, check your xml with the following

<android.support.design.widget.TextInputLayout   
android:id="@+id/input_layout_name"
android:layout_width="match_parent"
android:layout_height="wrap_content">

<EditText android:id="@+id/input_name" 
android:layout_width="match_parent"
android:layout_height="wrap_content" 
android:singleLine="true" 
android:hint="@string/hint_name" /> 
</android.support.design.widget.TextInputLayout> 
0
source

This doesn’t work well when you take drawable for edittext, so do it like give paddding for both

 <android.support.design.widget.TextInputLayout
android:id="@+id/input_layout_usernameL"
android:theme="@style/MyTextInputLayout"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:background="@drawable/yourdrawablerectagular"
android:padding="10dp"
 >

<EditText
    android:id="@+id/etUsername"
    android:layout_width="fill_parent"
    android:layout_height="wrap_content"
    android:layout_marginBottom="10dp"
    android:background="@null"
    android:hint="Username"
    android:padding="10dp"/>


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

, .:

.

<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
    android:layout_width="match_parent"
    android:layout_height="wrap_content"
    android:layout_margin="10dp"
    android:orientation="vertical" >

    <RelativeLayout
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:layout_marginTop="13dp"
        android:background="@drawable/test"
        android:padding="38dp" />

    <android.support.design.widget.TextInputLayout
        android:id="@+id/input_layout_name"
        android:layout_width="match_parent"
        android:layout_height="wrap_content" >

        <EditText
            android:id="@+id/input_name"
            android:layout_width="match_parent"
            android:layout_height="wrap_content"
            android:background="@null"
            android:hint="Email"
            android:padding="10dp"
            android:singleLine="true" />
    </android.support.design.widget.TextInputLayout>

</RelativeLayout>

:

enter image description here

, , .

, .

0

Source: https://habr.com/ru/post/1649509/


All Articles