Android Design Support Library(一
一、继承关系:

从继承关系上看出来,FloatingActionButton就是一个ImageButton,TextInputLayout就是一个LinearLayout,TextInputEditText就是一个EditText
效果图如下:
二、使用方法:

属性含义(可选)
app:backgroundTint - 设置FloatingActionButton背景颜色。
app:rippleColor - 设置FloatingActionButton点击时的背景颜色。
app:elevation - 默认状态下FloatingActionButton阴影大小。
app:pressedTranslationZ - 点击FloatingActionButton时的阴影大小。
app:fabSize - 设置FloatingActionButton大小,该属性有两个值,分别为normal和mini
app:layout_anchor - 设置锚点,以哪个控件为参照点设置位置。
app:layout_anchorGravity - 设置相对锚点的位置,值有 bottom、center、right、left、top等。
FloatingActionButton这个控件还是比较简单的继承自ImageView,可以直接当成ImageView来使用。




代码里直接设置:
TextInputEditText.setError(“密码不能为空”);//错误提醒的文字
或者使用:
TextInputLayout.setErrorEnabled(true); //开启错误提醒
TextInputLayout.setError(“密码不能为空”); //错误提醒的文字
TextInputLayout.setErrorEnabled(false); //关闭错误提醒
这里两种写法的UI显示不一样,自行尝试!
三、总结
相关使用非常简单,这三个控件都位于design包,实现的UI效果也是均为MD效果打造;
文章里的代码是我写的一个小项目中截取出来的,github地址为:https://github.com/Zzz468005600/Stone.git