TextInputLayout使用时各个地方的字体颜色
我们现在在做Android端的输入框时,要具备如下功能:
默认提示
获取焦点时提示上移至输入框顶部
获取焦点时输入框有提示
错误时增加错误提示
直接上图:
默认情况:
获取焦点时:
开始输入文字时:
有错误时:
代码为(只写上图其中一个输入框):
<android.support.design.widget.TextInputLayout
android:id="@+id/til"
app:hintTextAppearance="@style/textInputLayoutHint"
app:errorTextAppearance="@style/textInputLayoutError"
android:textColorHint="@color/color_CED2D9"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="vertical">
<com.test.widget.textinput.TrainEditText
android:layout_marginBottom="-4dp"
app:dropdown_enable="false"
android:importantForAutofill="noExcludeDescendants"
android:id="@+id/edit_text"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_centerVertical="true"
android:ellipsize="end"
android:drawablePadding="5dp"
android:paddingBottom="18dp"
android:imeOptions="actionNext"
android:inputType="text"
android:lines="1"
android:theme="@style/EditTextTheme"
android:textCursorDrawable="@drawable/train_edittext_cursor_color"
android:maxLines="1"
android:textColor="@color/color_train_main_text"
android:textColorHint="@color/color_8592A6"
android:textSize="17dp"
android:visibility="visible"
tools:ignore="UnusedAttribute" />
</com.test.widget.textinput.TrainEditText>
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
注意:TrainEditText是封装的TextView
那么接下来逐一介绍一下各个地方字体的颜色设置方法:以“姓氏”这个输入框为
TextInputLayout使用时各个地方的字体颜色的更多相关文章
- VC、MFC中设置控件的背景色、标题、字体颜色、字体要注意的地方[转]
在MFC中设置控件的背景色.字体.字体颜色.标题等属性主要是利用OnCtlColor函数来实现. 如: HBRUSH CAlarm::OnCtlColor(CDC* pDC, CWnd* pWnd, ...
- 【SpringMVC】<context:include-filter>和<context:exclude-filter>使用时要注意的地方
http://jinnianshilongnian.iteye.com/blog/1762632 http://blog.51cto.com/wenshengzhu/1700340 http://ww ...
- <context:component-scan>子标签:<context:include-filter>和<context:exclude-filter>使用时要注意的地方
在Spring MVC中的配置中一般会遇到这两个标签,作为<context:component-scan>的子标签出现. 但在使用时要注意一下几点: 1.在很多配置中一般都会吧Spring ...
- c++控制输出的字体颜色
SetConsoleTextAttribute(参数表).SetConsoleTextAttribute()函数是一个API设置字体颜色和背景色的函数.参数表中使用两个属性(属性之间用,隔开).Get ...
- PowerDesigner15使用时的十五个问题
15个问题列表: No.1:是不是一定要从CDM开始设计,然后在进行PDM的设计? NO.2:工具栏palette不见了,如何把它找出来? NO.3: 如何建立与数据库的关联? NO.4: 域和数据项 ...
- UILabletext去掉乱码 控制颜色 行高 自定义大小 。显示不同的字体颜色、字体大小、行间距、首行缩进、下划线等属性(NSMutableAttributedString)
text去掉乱码 设置不同颜色 行高 自定义大小 #import <Foundation/Foundation.h> @interface TextsForRow : NSObject @ ...
- HTML中设置超链接字体 & 字体颜色
定义链接样式 CSS为一些特殊效果准备了特定的工具,我们称之为“伪类”.其中有几项是我们经常用到的,下面我们就详细介绍一下经常用于定义链接样式的四个伪类,它们分别是: :link :visited : ...
- Unity 同一Text文本修改不同的字体大小和字体颜色
类似Html,在color和size对应的<>str</>中,就能修改str的相关属性, 下面的代码就是把time改为字体颜色为红色,大小为40: 而前面的"Time ...
- winform在设置控件enabled=false后,无法更改控件字体颜色的问题
项目界面设计的时候,发现在设置button的enabled=false后,原本设计的字体颜色跟预设的不一样,查了一些资料后,在网上看到这样一段代码: [System.Runtime.InteropSe ...
随机推荐
- Python3-paramiko-SFTP上传文件夹到多台远程服务器
# coding: utf-8 import paramiko import re import os from time import sleep # 定义一个类,表示一台远端linux主机 # 参 ...
- PHP array_diff_uassoc()
定义和用法 array_diff_uassoc() 函数使用用户自定义的回调函数 (callback) 做索引检查来计算两个或多个数组的差集.返回一个数组,该数组包括了在 array1 中但是不在任何 ...
- BZOJ 1492 货币兑换 cdq分治或平衡树维护凸包
题意:链接 方法:cdq分治或平衡树维护凸包 解析: 这道题我拒绝写平衡树的题解,我仅仅想说splay不要写挂,insert边界条件不要忘.del点的时候不要脑抽d错.有想写平衡树的去看140142或 ...
- Think in ISP(image sensor pipe )之How to implement an effecitive AE
How to implement a effecitive AE. AE(自己主动曝光) 1)try Minual exposure //time,line 2)try Max exposure // ...
- shell EOF注意点
当sqlplus与shell交互的时候我们这么用 su - oracle -c "sqlplus / as sysdba<<EOF select * from gv($insta ...
- 你不知道的JavaScript--Item33 跨域总结与解决的方法
一.神马是跨域(Cross Domain) 说白点就是post.get的url不是你当前的站点,域名不同.比如在*aaa.com/a.html*里面,表单的提交action是bbb.com/b.htm ...
- cocos2d-x 3.1.1 学习笔记[16] Particle 粒子效果
//plist文件中面有粒子效果的各种參数 //textureFileName相应着使用粒子的图片 auto particle = ParticleSystemQuad::create("s ...
- oc36--自定义构造方法在继承中的表现
// // Person.h #import <Foundation/Foundation.h> @interface Person : NSObject @property int ag ...
- Linux gadget驱动分析1------驱动加载过程
为了解决一个问题,简单看了一遍linux gadget驱动的加载流程.做一下记录. 使用的内核为linux 2.6.35 硬件为芯唐NUC950. gadget是在UDC驱动上面的一层,如果要编写ga ...
- Linux C语言头文件搜索路径
本文介绍在linux中头文件的搜索路径,也就是说你通过include指定的头文件,linux下的gcc编译器它是怎么找到它的呢.在此之前,先了解一个基本概念. 头文件是一种文本文件,使用文本编辑器将代 ...