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 ...
随机推荐
- Spring MVC-控制器(Controller)-多动作控制器(Multi Action Controller)示例(转载实践)
以下内容翻译自:https://www.tutorialspoint.com/springmvc/springmvc_multiactioncontroller.htm 说明:示例基于Spring M ...
- 阿伦 凯 Alan Kay 面向对象编程思想创始人
The best way to predict the future is to invent it. 预测未来最好的办法就是创造它.
- [Angular] Remove divs to Preserve Style and Layout with ng-container in Angular
The Angular <ng-container> is a grouping element that doesn't interfere with styles or layout ...
- ORACLE11G设置IP訪问限制
出于数据安全考虑,对oracle数据库的IP做一些限制,仅仅有固定的IP才干訪问. 改动$JAVA_HOME/NETWORK/ADMIN/sqlnet.ora文件 添加下面内容(红色表示凝视): #开 ...
- ZOJ Monthly, November 2012
A.ZOJ 3666 Alice and Bob 组合博弈,SG函数应用 #include<vector> #include<cstdio> #include<cstri ...
- 关于MySQL错误 2005 - Unknown MySQL server host 'localhost' (0) 原因及解决方法
今天在外面开navicat for mysql的时候,怎么也连不上自己本机上的数据库,一直显示2005 - Unknown MySQL server host 'localhost' (0): 错误代 ...
- pass an instance of class to TestCase as parameter
use testcasesource instead https://stackoverflow.com/questions/4220943/how-to-pass-dynamic-objects-i ...
- 讲一讲WiFi快连、SmartConfig、SmartConnect
最近要给公司同事们培训WiFi快连技术,整理了相关资料,也分享在博客这,献给有缘人. 前言 现在的智能硬件产品,以WiFi品类居多,这些WiFi硬件没有人机交互界面,但设备要上网肯定要配置SSID等相 ...
- C++<iomanip>控制符
C++<iomanip>控制符 c++ cout 输出格式 在c++程序里面经常见到下面的头文件 #include <iomanip> io代表输入输出,manip是manip ...
- Coursera Algorithms week1 算法分析 练习测验: 3Sum in quadratic time
题目要求: Design an algorithm for the 3-SUM problem that takes time proportional to n2 in the worst case ...