1、打开我们的编辑软件eclipse软件,如图所示;然后建立一个工程,至于怎么建工程,我相信小伙伴们应该知道怎么弄了;
2、找到文件目录,res-layout下的一个文件,然后选择,activity_main.xml。如图中所示,打开文档。
3、在整个界面中输入一下代码:<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" xmlns:tools="http://schemas.android.com/tools" android:layout_width="fill_parent" android:layout_height="fill_parent" android:orientation="horizontal"> <Button android:id="@+id/button1" android:layout_width="wrap_content" android:layout_height="wrap_content" android:text="寻迹" android:layout_weight="1" /> <Button android:id="@+id/button2" android:layout_width="wrap_content" android:layout_height="wrap_content" android:text=" 壁障" android:layout_weight="1" /> <Button android:id="@+id/button3" android:layout_width="wrap_content" android:layout_height="wrap_content" android:text=" 追踪" android:layout_weight="1" /> <Button android:id="@+id/button4" android:layout_width="wrap_content" android:layout_height="wrap_content" android:text=" 学习" android:layout_weight="1" /> <TextView android:layout_width="wrap_content" android:layout_height="wrap_content" android:text="@string/hello_world" /></LinearLayout>接着保存;
4、点击如图所示的地方进行执行,我们的软件;
5、如图所示,我们的执行结果如下;