Android EditText视图材质设计中的浮动提示 [英] Android EditText view Floating Hint in Material Design

查看:103
本文介绍了Android EditText视图材质设计中的浮动提示的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

API 21是否提供使用以下功能的方法:

Does API 21 provide a method to use the following feature:

http://www.google.com/design/spec/components/text-fields.html#text-fields-floating-labels

我正在尝试浮动EditText提示.

I'm trying to float the EditText hints.

谢谢!

推荐答案

浮动提示EditText:

Floating hint EditText:

在gradle中添加以下依赖项:

Add below dependency in gradle:

compile 'com.android.support:design:22.2.0'

在布局中:

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

        <EditText
            android:id="@+id/editText"
            android:layout_width="match_parent"
            android:layout_height="wrap_content"
            android:hint="UserName"/>
    </android.support.design.widget.TextInputLayout>

这篇关于Android EditText视图材质设计中的浮动提示的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆