一直想写点东西,但不知道写什么,一直在学Android开发,正好借此机会练练写作,呵呵,长话短说,今天学习Android的Button控件和TextView控件,什么??你还不会建立Android开发平台?那麻烦您去百度或是Google一下吧.
Button控件有事件监听,如果想处理单击事件的话,就需要为Button控件注册监听器,好了,我们来看一下今天的代码,首先是main.xml
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:orientation="vertical" android:layout_width="fill_parent"
android:layout_height="fill_parent">
<TextView android:id="@+id/text" android:layout_width="fill_parent"
android:layout_height="wrap_content" android:text="@string/hello" />
<Button android:layout_width="match_parent"
android:layout_height="wrap_content" android:text="按钮" android:id="@