又到了有空闲的时间,趁机写一章教程先。
在本章教程中,我们将会学习Button控件的使用,同时顺便说一下Toast提示控件。
在Android程序开发中,我们使用最多的用户交互控件可能就是Button的了,而我们使用最多的事件估计也就是onclick事件了。
这些事件也是最简单的事件,我们一般通过google自带的API接口就可以调用了,我们具体看看怎么做吧。
第一步。新建一个工程Ep.Toast,活动和主视图名称我都使用默认的了,设置一下视图activity_main.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_vertical_margin"
android:paddingLeft="@dimen/activity_ho