这个视图原始框架地址:https://github.com/rengwuxian/MaterialEditText

指导手册:http://www.rengwuxian.com/post/materialedittext#content

接下来是我学习和总结的时候了:

1,没配置相关属性参数:

<com.yh.materialeditlibrary.MaterialEditTextandroid:id="@+id/basicEt"android:layout_width="0dp"android:layout_height="wrap_content"android:layout_weight="1"android:hint="Basic" />

效果:

设置为不可用状态:

enableBt.setOnClickListener(new View.OnClickListener() {@Overridepublic void onClick(View v) { basicEt.setEnabled(!basicEt.isEnabled());enableBt.setText(basicEt.isEnabled() ? "DISABLE" : "ENABLE");}});

效果:

1 BaseColor

文档里面是这么说的:

Base Color 被用作背景线的颜色、主字体的颜色(透明度被重置为87%)和提示字体的颜色(透明度被重置为26%)。你可以使用app:baseColor(xml) 或者 setBaseColor()(java) 来指定 Base Color 。Base Color 的默认值为纯黑

修改为红色:

 <com.yh.materialeditlibrary.MaterialEditTextandroid:layout_width="match_parent"android:layout_height="wrap_content"android:hint="Custom Base Color"app:baseColor="@color/red" />

效果:

2 Primary Color

自定义Primary Color

Primary Color 被用作激活状态的输入框背景色、高亮的Floating Label色和底部省略号的颜色。你可以使用 app:primaryColor (xml) 或者 setPrimaryColor()(java) 来指定 Primary Color。如果没有设置Primary Color,默认将使用 Base Color 来替代

也就是获取焦点状态时的底部颜色

默认颜色为红色,点击后显示为绿色的底.

<com.yh.materialeditlibrary.MaterialEditTextandroid:layout_width="match_parent"android:layout_height="wrap_content"android:hint="Custom Primary Color"app:baseColor="@color/red"app:primaryColor="@color/green" />

没点击状态:

点击后:

3 Floating Label

Floating Label 有三种模式: none , normal , highlight 。 你可以使用 app:floatingLabel (xml) 或者setFloatingLabel() (java) 来设置 Floating Label 的模式

从效果中明显看出是在EditText上面显示的问题的高亮程度,none,压根不显示,normal 默认的亮度,hightlight 高亮显示

none:

xml:

<com.yh.materialeditlibrary.MaterialEditTextandroid:layout_width="match_parent"android:layout_height="wrap_content"android:hint="Floating Label"app:floatingLabel="none" />

<com.yh.materialeditlibrary.MaterialEditTextandroid:layout_width="match_parent"android:layout_height="wrap_content"android:hint="Highlight Floating Label"app:floatingLabel="normal" />

<com.yh.materialeditlibrary.MaterialEditTextandroid:layout_width="match_parent"android:layout_height="wrap_content"android:hint="Highlight Floating Label"app:floatingLabel="highlight" />

4 singleLineEllipsis

当设置显示底部省略号后,控件会在文字向左滚动时在底部左侧显示一个三个点的省略号,点击省略号将自动把光标置于字符串的开始处。你可以通过 app:singleLineEllipsis=true (xml) 或者 setSingleLineEllipsis() (java) 来设置它。这个属性将自动设置android:singleLine 为 true

首先这个控件在不选中是不显示...的,而且滑动到最左侧,...小时,滑向右侧,...出现

 <com.yh.materialeditlibrary.MaterialEditTextandroid:id="@+id/singleLineEllipsisEt"android:layout_width="match_parent"android:layout_height="wrap_content"android:hint="Single Line Ellipsis"android:text="soyoungboy is beautiful ,so cool ,so nice ,so smart"app:singleLineEllipsis="true" />

效果:

5  maxCharacters

设置字符数限制后,控件右下角会显示已输入字符数和最大字符数的角标,并在超过限制后显示警告色(默认为红色)。 你可以通过app:maxCharacters (xml) 或者 setMaxCharacters() (java) 来设置字符数,通过 app:errorColor 或者 setErrorColor()(java) 来自定义警告色

app:maxCharacters="10" 设置最长文字长度10个没超过10个字:

当超过10个字时,效果如下:

6 自定义 error color自定义警告颜色:比如设置超过10个字时,颜色为绿色
 <com.yh.materialeditlibrary.MaterialEditTextandroid:layout_width="match_parent"android:layout_height="wrap_content"app:errorColor="@color/green"app:maxCharacters="10" />

 

MaterialEditText 控件学习相关推荐

  1. IOS学习笔记(四)之UITextField和UITextView控件学习

    IOS学习笔记(四)之UITextField和UITextView控件学习(博客地址:http://blog.csdn.net/developer_jiangqq) Author:hmjiangqq ...

  2. ListView控件学习系列2-编辑ListView(Edit,Update,Insert,Delete)

    目录: ListView控件学习系列1-了解ListView控件 ListView控件学习系列2-编辑ListView ListView控件学习系列3-ListView选择,排序,分页 ListVie ...

  3. AJAX Control Toolkit 控件学习(转自csdn山巅)

    AJAX Control Toolkit 控件学习 2006-1-16 ToggleButton 关联ASP.NET CheckBox控件 RoundedCorder 造就圆角框 PasswordSt ...

  4. wxpython制作表格界面_[Python] wxPython 菜单栏控件学习总结(原创)

    1.总结 1.大体创建过程 1.创建一个 菜单栏 : menuBar = wx.MenuBar() 相当于这个白色地方,没有File这个菜单 2.创建 菜单 : fileMenu = wx.Menu( ...

  5. 【转贴】ListView控件学习系列2-编辑ListView

    [转贴]ListView控件学习系列2-编辑ListView 作者:方明 原贴地址:http://www.cnblogs.com/nuaalfm/archive/2008/09/02/1281885. ...

  6. Asp.net.Ajax控件学习

    Asp.net.Ajax控件学习:  1.  Accordion 功能:     实现了QQ.Msn好友分类的折叠效果,就像包含了多个CollapsiblePanels .  2.  AlwaysVi ...

  7. 【Autojs教程】03-Autojs 控件学习 | 淘宝关注店铺取消实战

    [Autojs教程]03-Autojs 控件学习 | 淘宝关注店铺取消实战 写在前面 本篇教程构思良久,笔者希望通过一个实际的例子,将枯燥无味的函数放到程序中进行讲解,前面一部分是理论教程(还是更加希 ...

  8. CGRidCtrl控件 学习心得

    wuqinxiang0我的:收件箱资源博客空间设置|帮助|退出 首页 业界 移动 云计算 研发 论坛 博客 下载 更多 狂想盼盼 积累点点滴滴 目录视图 摘要视图 订阅 新版论坛系列介绍之二--功能介 ...

  9. winform控件学习(2)—HScrollBar控件和MaskedTextBox控件

    好几天没系统的总结了,感觉忘得很快,还是记录下来比较好.废话不说了,接着介绍几个使用频率比较高的控件. 1.HScrollBar控件:在窗体实现一个水平滚动的滚动条,以便在较长的项列表中或大量信息中转 ...

最新文章

  1. C语言不用strcmp函数比较字符串大小
  2. ListView与DateGridView
  3. redis(12)--事件,客户端,服务器
  4. PostgreSQL学习笔记9之事务隔离
  5. 面试官问你B树和B+树,就把这篇文章丢给他
  6. 5分钟制作Unity过场动画 | Timeline
  7. 【jQuery笔记Part3】03-jQuery项目:随机抽奖
  8. 趣学 C 语言(二)—— typedef 与 #define
  9. ae去闪插件deflicker使用_Ae/Pr视频去闪烁插件REVisionFX DEFlicker v1.7.1 Win大众脸已注册...
  10. 计算机第二章测试题及答案,计算机组成原理第二章练习题及答案
  11. android 解谜 游戏,Android解谜游戏《100个任务》图文攻略
  12. 清除COOKIES有什么好处
  13. Kill Demodogs——c++——pow_na的博客
  14. VSCode添加背景图片
  15. 正则html在线测试,正则表达式在线测试工具
  16. https安全传输揭秘 1
  17. 系统安装,UltraISO制作U盘系统安装盘
  18. 方舟编译器将开源!华为邀广大开发者助力鸿蒙系统
  19. tp接入富友H5支付
  20. 对话车品觉:顶级数据团队该像支配合默契的篮球队

热门文章

  1. C# 获取 ipv4的方法
  2. python Gevent – 高性能的Python并发框架
  3. 源路由 就是指定数据传输经过这个路由服务器
  4. Word中的字体大小
  5. 总结网站调用Flash的几种方法【转】
  6. NuGet学习笔记(2) 使用图形化界面打包自己的类库
  7. WCF关于svcutil生成关于TCP绑定出现 元数据包含无法解析的引用:“net.tcp://127.0.0.1:9999/xxxx/”的解决方案...
  8. centos中python报错 SyntaxError: Non-ASCII character ‘\xe7‘ in file car-training.py on line 7, but no en
  9. C语言 将字符串中数字字符全部删除
  10. ESAComp 2020中文版