使用AS发现模板下的LoginActivity,布局如下
<android.support.design.widget.TextInputLayout
android:layout_width="match_parent"
android:layout_height="wrap_content">
<AutoCompleteTextView
android:id="@+id/email"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:hint="@string/prompt_email"
android:inputType="textEmailAddress"
android:maxLines="1"
android:singleLine="true" />
</android.support.design.widget.TextInputLayout>
<android.support.design.widget.TextInputLayout
android:layout_width="match_parent"
android:layout_height="wrap_content">
<AutoCompleteTextView
android:id="@+id/password"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:hint="@string/prompt_password"
android:imeActionId="@+id/login"
android:imeActionLabel="@string/action_sign_in_short"
android:imeOptions="actionUnspecified"
android:inputType="textPassword"
android:maxLines="1"
android:singleLine="true" />
</android.support.design.widget.TextInputLayout>
代码里面在验证的时候,只需要使用
mEmailView.setError(getString(R.string.error_field_required));
就可以获取如jQuery的效果
感觉比你自己Toast弹窗的效果要更好。当然低版本是不支持的, 我的版本23.0.1可以,降低至22.+(22.0.1就不行, 有error icon)但是没有popup出来
- 大小: 44.3 KB
分享到:
相关推荐
xamarin textInputLayout的使用,material design 拿来就用的空间TextInputLayout,原文地址http://blog.csdn.net/kebi007/article/details/70756778
Android使用文本输入布局TextInputLayout的代码例子。用于演示文本输入布局TextInputLayout和文本输入编辑框TextInputEditText对编辑框的功能增强。
本教程中,我将再次讨论Material Design。Google I/O 2015 对于每一个开发者来说都是一个重大的事件,设计当然也是谈资之一。 谷歌意识到向后兼容是实现material design的重要部分。当然support library,比如...
使用TextInputLayout构造Material Design效果的登录注册框架,有兴趣的朋友可以看看
默小铭的博客 : TextInputLayout与TextInputEditText详解 附件Demo http://blog.csdn.net/u012792686/article/details/73089227
TextInputLayout实现网易邮箱登录界面,中间还简单介绍怎么使用Snackbar.zip
android的design包中FloatingActionButton,TextInputLayout,Snackbar控件的使用
Android Material 之NavigationView和TextInputLayout的使用,详细介绍地址:http://blog.csdn.net/amazing7/article/details/52035324
这是在设计支持库中找到的TextInputLayout的简单定制。 尽管这是一个很棒的组件,我们已经大量使用它,但我们希望能够显示计数器,以便显示的值为: 未按照支持库版本的格式进行格式化 仅在距离最大计数器值达到...
作者Berial,源码TextInputLayout,在 Material Design 官方文档 中的 Errors 一节里,使用的 TextInputLayout 的右下角有一个字数统计的功能,但是我在查看 TextInputLayout 的源码时发现,虽然它在 attrs.xml 里...
MaterialSpinner:具有TextInputLayout功能的Android Material Spinner的实现
在此示例应用程序中,您将找到如何使用TextInputLayut。 您还可以找到如何更改其提示颜色以及如何应用字体。如何申请字样private void setTypefaceToInputLayout(TextInputLayout inputLayout, String typeFace){ ...
封装的TextInputLayoutView除了安卓的常规功能 还添加了可能使用到的数字键盘 1.属性keyBoadType 当传入为1时说明键盘只允许输入数字 当传入数字为2时除了数字还能输入小数点 而且在数字键盘上添加了完成键 按下完成...
封装的TextInputLayoutView除了安卓的常规功能 还添加了可能使用到的数字键盘 1.属性keyBoadType 当传入为1时说明键盘只允许输入数字 当传入数字为2时除了数字还能输入小数点 而且在数字键盘上添加了完成键 按...
Android Material AppCompat编辑文本着色新的TextInputLayout疯狂地定制了如此多的状态和条件。 此回购包含了我为弄清楚某些样式而使用的示例。 字体不是自定义的(请参见 )。 最有用的是 。
TabLayout的使用细节,SearchView的调整适应【2020-12-13】优化,主题切换到材质组件【2020-11-18】整个项目升级,改造,支持转androidX,java转kotlin搜寻侧边栏,应力底部提示滑动收起Tab滑动收起自定义标签底部...
回收站视图RecyclerView,CollapsingLayout,Viewpager,TabLayout拖动,RecyclerView,CardView,TextInputLayout,ExpandableView,NavigationView的拖放功能该项目包含使用recyclerview并探索其多种功能的多种...
android 新增包design包的一些使用demo,包含:toolbar、NavigationView、CoordinatorLayout、AppBarLayout、TabLayout、CollapsingToolbarLayout、FloatingActionButton、TextInputLayout