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中的 ...
随机推荐
- free命令查看内存信息
free介绍 FREE(1) Linux User’s Manual FREE(1) NAME free - Display amount of free and used memory in the ...
- Shiro 系列 - 基本知识
和 Spring Security 项目一样, Apache Shiro 也是一个被广泛使用安全框架, 它们都能完成认证.授权.会话管理等. 简单对比一下 Apache Shiro 和 Spring ...
- wc 命令详解
1.wc 命令作用 统计文件里面有多少单词,多少行,多少字符. 2.wc 语法 wc [-lwm] 选项与参数:-l :仅列出行:-w :仅列出多少字(英文单字):-m :多少字符: 3.例子 使用w ...
- error: no matching function for call to 'std::exception:exception(const char[16])'
环境:codeblocks 语言:C++ 在执行:throw new exception("queue is empty.");时 遇到问题:error: no matching ...
- AC的故事大结局山寨版(下)
AC的故事大结局山寨版(下) TimeLimit:2000MS MemoryLimit:128MB 64-bit integer IO format:%lld Problem Descripti ...
- 【原创】大叔经验分享(14)spark on yarn提交任务到集群后spark-submit进程一直等待
spark on yarn通过--deploy-mode cluster提交任务之后,应用已经在yarn上执行了,但是spark-submit提交进程还在,直到应用执行结束,提交进程才会退出,有时这会 ...
- const与#define相比有什么不同?
C++语言可以用const定义常量,也可以用#define定义常量,但是前者比后者有更多的优点:● const常量有数据类型,而宏常量没有数据类型.编译器可以对前者进行类型安全检查,而对后者只进行字符 ...
- js 校验 btc eth 地址
NPM 安装 npm install wallet-address-validator Browser <script src="wallet-address-validator.mi ...
- 【微信小程序】 wx:if 与 hidden(隐藏元素)区别
wx:if 与 hidden 都可以控制微信小程序中元素的显示与否. 区别: wx:if 是遇 true 显示,hidden 是遇 false 显示. wx:if 在隐藏的时候不渲染,而 hidden ...
- element el-tree 添加图标
1.指定渲染函数:render-content="renderContent" <el-tree ref="tree" :data="funct ...