1.首先创建一个安卓项目,在打开res文件夹下的layout下的布局文件layout_main,里面会有默认的代码!
2.以下将附代码,仅供参考。
3.代码如下:
<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_horizontal_margin" android:paddingRight="@dimen/activity_horizontal_margin" android:paddingTop="@dimen/activity_vertical_margin" tools:context=".MainActivity" > <TextView android:layout_width="wrap_content" android:layout_height="wrap_content" android:text="@string/hello_world" /> </RelativeLayout>
4.在项目下鼠标右键点击Run As运行Android Application运行安卓模拟器,将会在模拟器中显示HelloWorld!