出来工作好几年了,最近冷静下来总结发现自己技术真心不咋的,所以决定开始写博客来锻炼自己。
想了想写什么好呢,又不是大牛,所以写不出非常高深的好文章出来,所以从最基础的写起走。2015 I/O大会谷歌推出了 Android Design Support Library,所以就更新下来看了看。从最简单的开始写吧,来看TextInputLayout,为什么要使用TextInputLayout,这个控件用于在多个输入框时,用户可能忘记hint内容,这个时候hint提醒就会在上方显示,也能用于判断,界面挺美的。先直上效果图。
这就是TextInputLayout实现的效果。接下来我们先看他的使用方法再去看源码。
使用前我们更新android sdk,最近不需要翻墙就可以更新androidsdk建议全部更新。本次需要使用到的是Extras下的Android Support Library。使用的开发工具是Android studio。
新建一个Activity。然后导入lib库。右击项目选择Open Module Settings --->选择Dependencies--->选择library dependency--->然后找到design---->ok.导入库的步骤就完了。
导入后大家可以去项目的build.gradle里面看看,会在dependencies里面多一句
compile 'com.android.support:design:23.0.0'
接下来我们再看看我们的xml文件:
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:paddingBottom="@dimen/activity_verti