如何在Android TextInputEditText视图中定位浮动提示

时间:2017-02-21 18:43:11

标签: android material-design

在Android版面xaml中的TextInputEditText内使用TextInputLayout,可以创建Matrial风格的文字输入字段,并且可以快速启动'提示文本在您开始输入时会移开。如何使提示显示在输入文本的上方,而不是默认情况下?

编辑:你要了照片......

enter image description here

1 个答案:

答案 0 :(得分:1)

您可以通过在TextInputEditText上添加顶部填充来实现此目的。例如:

<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