现在的位置: 首页 > 综合 > 正文

Android 应用之最简main.xml说明

2012年06月11日 ⁄ 综合 ⁄ 共 785字 ⁄ 字号 评论关闭

<?xml version="1.0" encoding="utf-8"?> //指示这个文本文件是以XML格式描述的
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"//XML描述文件的名称空间是后面的URL网址
    android:layout_width="fill_parent"  //填满整个上层空间
    android:layout_height="fill_parent" //填满整个上层空间
    android:orientation="vertical" >      //这个界面的的版面配置方式是从上而下的垂直地排列其内含的界面组件

    <TextView                                    //显示文本,可以设定为可编辑.TextView是一个完整的文本编辑器,基类被配置成为不可编辑
        android:layout_width="fill_parent" //宽度值填满LinearLayout整个界面
        android:layout_height="wrap_content" //随着文字字段行数的不同而改变TextView的高度
        android:text="@string/hello" />  //显示对应的文字

</LinearLayout>

关于TextView,请见:http://developer.android.com/reference/android/widget/TextView.html

Android内建的版面配置方式

名称

配置方式

LinearLayout 线性版面配置
FrameLayout 框架版面配置
TableLayout 表格版面配置
RelativeLayout 相对位置版面配置

抱歉!评论已关闭.