TextInputLayout 用法
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout
xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical"
> <!--只能有一个子控件,必须是edit-->
<android.support.design.widget.TextInputLayout
android:layout_width="match_parent"
android:id="@+id/tl_username"
android:layout_height="wrap_content"> <android.support.design.widget.TextInputEditText
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:hint="用户名"
android:maxLength="25"
android:maxLines="1"
/> </android.support.design.widget.TextInputLayout>
<android.support.design.widget.TextInputLayout
android:layout_width="match_parent"
android:id="@+id/tl_password"
android:layout_height="wrap_content"> <android.support.design.widget.TextInputEditText
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:hint="密码"
android:maxLength="25"
android:maxLines="1"
android:inputType="textPassword"
/> </android.support.design.widget.TextInputLayout> <Button
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="登录"
android:layout_gravity="center_horizontal"
android:id="@+id/btnLogin"
/> </LinearLayout>
package com.xiaozhuyisheng.jinjiedemos.activity; import android.support.design.widget.TextInputLayout;
import android.view.View; import com.xiaozhuyisheng.jinjiedemos.BaseActivity;
import com.xiaozhuyisheng.jinjiedemos.R; import butterknife.BindView; public class TextInputLayoutDemoActivity extends BaseActivity { @BindView(R.id.tl_password)
TextInputLayout tl_password; @Override
protected int initLayoutID() {
return R.layout.activity_text_input;
} @Override
protected void initLogic() { findViewById(R.id.btnLogin).setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View view) {
tl_password.setError("密码错误");
}
});
}
}
TextInputLayout 用法的更多相关文章
- Android5.0之TextInputLayout、FloatingActionButton的使用
TextInputLayout和FloatingActionButton都属于MD风格的控件,比起普通的EditText和Button.ImageButton,TextInputLayout和Floa ...
- 【Android - MD】之TextInputLayout的使用
TextInputLayout是Android 5.0新特性--Material Design中的一个布局控件,主要用来嵌套EditText,实现数据输入时的一些效果,如: 当输入框获取焦点时,输入提 ...
- Android学习之Design Support Library中TextInputLayout的使用
今天学习了一个Android Design Support Library 中的TextInputLayout控件,感觉还不错,较之以往的Editetxt,多了几分灵活性,使用也非常easy,故此给大 ...
- Android Material Design控件学习(三)——使用TextInputLayout实现酷市场登录效果
前言 前两次,我们学习了 Android Material Design控件学习(一)--TabLayout的用法 Android Material Design控件学习(二)--Navigation ...
- Android Design Support Library(2)- TextInputLayout的使用
原创文章,转载请注明 http://blog.csdn.net/leejizhou/article/details/50494634 这篇文章介绍下Android Design Support Lib ...
- 【Android - 控件】之MD - TextInputLayout的使用
TextInputLayout是Android 5.0新特性——Material Design中的一个布局控件,主要用来嵌套EditText,实现数据输入时的一些效果,如: 当输入框获取焦点时,输入提 ...
- EditText 基本用法
title: EditText 基本用法 tags: EditText,编辑框,输入框 --- EditText介绍: EditText 在开发中也是经常用到的控件,也是一个比较必要的组件,可以说它是 ...
- jquery插件的用法之cookie 插件
一.使用cookie 插件 插件官方网站下载地址:http://plugins.jquery.com/cookie/ cookie 插件的用法比较简单,直接粘贴下面代码示例: //生成一个cookie ...
- Java中的Socket的用法
Java中的Socket的用法 Java中的Socket分为普通的Socket和NioSocket. 普通Socket的用法 Java中的 ...
随机推荐
- 数据结构Java实现04---树及其相关操作
首先什么是树结构? 树是一种描述非线性层次关系的数据结构,树是n个数据结点的集合,这些集结点包含一个根节点,根节点下有着互相不交叉的子集合,这些子集合便是根节点的子树. 树的特点 在一个树结构中,有且 ...
- 五十、进程间通信——System V IPC 之共享内存
50.1 共享内存 50.1.1 共享内存的概念 共享内存区域是被多个进程共享的一部分物理内存 多个进程都可把该共享内存映射到自己的虚拟内存空间.所有用户空间的进程若要操作共享内存,都要将其映射到自己 ...
- Java CAS 比较并且更换值
原文:Java中CAS详解 作者:jayxu无捷之径 在JDK 5之前Java语言是靠synchronized关键字保证同步的,这会导致有锁 锁机制存在以下问题: (1)在多线程竞争下,加锁.释放锁会 ...
- clam简单使用
clam简单使用: 0,首先,要全局安装Nodejs,不再赘述.clam依赖node使用 1,打开 cmd 2,全局安装clam:npm -g install clam 3,切换到目的盘下,新建一个空 ...
- SpringMVC核心类和注解
springMVC最重要的就是前端控制器DispatchServlet了.他是整个springMVC应用的核心. 需要将它配置在web.xml中. 1.DispatchServlet的配置 <! ...
- css Modules 使用
我目前常用的也就是引用类名,以及在需要修改某个ui组件原有的样式比较麻烦时,会使用 :global className{ color: red;}这样来修改... 更多请参考阮老师博客: http:/ ...
- Python mac安装mysqlclient的一个bug
这是一个来自mysql官方的bug,反正我是看不懂. shuais-MBP:wxapp dandyzhang$ pipenv install mysqlclient Installing mysqlc ...
- C# - 常用接口
常用接口 用于比较接口 IComparable<T> 接口内部定义了用于比较两个对象大小的CompareTo(T t)方法,>参数时返回1,=参数时返回0,<参数时返回-1.集 ...
- 题解-CodeChef IOPC14L Sweets Problem
Problem CodeChef-IOPC14L 题目概要:给定 \(n\) 种糖果且给定每种糖果的数量 \(A_i\),\(Q\) 组询问,每次问选出 \(S\) 个糖果的方案数(模\(10^9+7 ...
- linux磁盘阵列 逻辑卷管理器
Difficult doesn't mean impossible.It simply meansthat you have to work hard.困难并不代表不可能,它仅仅意味着你必须努力奋斗. ...