0

when i put 2 or 3 TextInputLayout, label seams link graphically to previous editText instead of next. i need to put much marginTop to TextInputLayout. there is any possibility to approach label with EditText?

<android.support.design.widget.TextInputLayout
    android:layout_width="match_parent"
    android:layout_height="wrap_content" >
    <EditText
        android:id="@+id/name"
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:hint="@string/name"
        android:inputType="textCapWords" />
</android.support.design.widget.TextInputLayout>

example

in this example we can see margin from hint and edittext

Alessandro Scarozza
  • 4,273
  • 6
  • 31
  • 39

2 Answers2

6

Changing the paddingTop of the EditText should fix it, for example:

<android.support.design.widget.TextInputLayout
    android:layout_width="match_parent"
    android:layout_height="wrap_content" >
    <EditText
        android:id="@+id/name"
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:paddingTop="0dp"
        android:hint="@string/name"
        android:inputType="textCapWords" />
</android.support.design.widget.TextInputLayout>
Huby
  • 871
  • 11
  • 16
1

You can definitely add properties to TextInputLayout however you want it to be. Following will help you to add marginTop from exactly above Viewof TextInputLayout

<android.support.design.widget.TextInputLayout
    android:layout_width="match_parent"
    android:layout_marginTop="20dp"
    android:layout_height="wrap_content" >
    <EditText
        android:id="@+id/name"
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:hint="@string/name"
        android:inputType="textCapWords" />
</android.support.design.widget.TextInputLayout>
Vikalp Patel
  • 10,669
  • 6
  • 61
  • 96