stovroz
stovroz

Reputation: 7065

How to position floating hints in an Android TextInputEditText view

Using TextInputEditText inside a TextInputLayout in an Android layout xaml, it's possible to create Matrial style text input fields with 'fly up' hint text which moves out of the way as you start typing. How can the hint be made to appear further above the inputted text than it does by default?

Edit: You asked for pictures...

enter image description here

Upvotes: 0

Views: 2048

Answers (1)

Mike M.
Mike M.

Reputation: 39191

You can do this rather simply by putting a top padding on the TextInputEditText. For example:

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

    <android.support.design.widget.TextInputEditText 
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:paddingTop="15dp" />

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

screenshot

Upvotes: 1

Related Questions