窗口的布局是在layout中的.xml文件中实现的

一般可以使用eclipse的代码提示功能 Alt+/来显示后面要加的属性值

首先看一下线性布局式样:LinearLayout

<?xml version="1.0" encoding="utf-8"?><LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"    android:layout_width="fill_parent"    android:layout_height="fill_parent"    android:orientation="vertical">    <!-- 窗口的布局,这里是垂直的,也可以是水平的   -->       <!--     android:id                ~~~~~~~~~~~~~ 为控件指定相应的ID,以便访问控件    android:text              ~~~~~~~~~~~~~ 指定控件当中显示的文字,这里尽量使用string.xml文件中定义的string    android:grivity           ~~~~~~~~~~~~~ 指定控件中显示的内容在控件中所处的位置    android:textSize          ~~~~~~~~~~~~~ 指定控件当中字体的大小    android:background        ~~~~~~~~~~~~~ 指定控件中所指定的背景色,用RGB方法    android:layout_width      ~~~~~~~~~~~~~ 控件宽度    android:layout_height     ~~~~~~~~~~~~~ 控件高度    android:padding*          ~~~~~~~~~~~~~ 控件的内边距    android:sigleLine         ~~~~~~~~~~~~~ 如果为真的话,则控件中的内容在同一行中显示,显示不完就用 ...表示    -->        <TextView         android:id="@+id/firstText"        android:text="first Line"        android:gravity="center_vertical"        android:textSize="18pt"        android:background="#aa0000"        android:layout_width="fill_parent"        android:layout_height="wrap_content"        android:paddingLeft="10dip"        android:paddingRight="30dip"        android:paddingTop="20dip"        android:paddingBottom="10dip"        android:layout_weight="1"        android:singleLine="true"/>    <TextView         android:id="@+id/secondText"        android:text="second Line"        android:gravity="center_vertical"        android:textSize="18pt"        android:background="#00aa00"        android:layout_width="fill_parent"        android:layout_height="wrap_content"        android:paddingLeft="10dip"        android:paddingRight="30dip"        android:paddingTop="20dip"        android:paddingBottom="10dip"        android:layout_weight="2"        android:singleLine="true"/>    <Button        android:id="@+id/myButton"        android:layout_width="fill_parent"        android:layout_height="wrap_content"        android:layout_weight="2"        /></LinearLayout>

再来看一下表格布局:TableLayout

<?xml version="1.0" encoding="utf-8"?><TableLayout xmlns:android="http://schemas.android.com/apk/res/android"    android:layout_width="fill_parent"    android:layout_height="fill_parent"    android:stretchColumns="0" >    <!-- 表示通过拉伸第一列来填满屏幕 -->        <!-- 第一行 -->    <TableRow>        <!-- 第一行中设置了三列 -->    <TextView        android:text="@string/row1_column1"        android:background="#aa0000"  android:padding="3dip" />    <TextView        android:text="@string/row1_column2"        android:background="#00aa00"  android:padding="3dip" />    <TextView        android:text="@string/row1_column3"        android:background="#0000aa"  android:padding="3dip" />    </TableRow>            <!-- 第二行 -->    <TableRow>        <!-- 第二行中设置了两列 -->    <TextView        android:text="@string/row2_column1"        android:background="#00aa00"  android:padding="3dip" />    <TextView        android:text="@string/row2_column2"        android:background="#0000aa"  android:padding="3dip" />    </TableRow></TableLayout>

更多相关文章

  1. 三、安卓UI学习(1)
  2. android用户界面之按钮(Button)教程实例汇
  3. 在Fragment中设置控件点击方法,执行失败。
  4. TabHost与RadioGroup结合完成的菜单【带效果图】5个Activity
  5. Android(安卓)P SystemUI之StatusBar UI布局status_bar.xml解析
  6. android用户界面-组件Widget-地图视图MapView
  7. Android(安卓)命令行编译、打包生成apk文件
  8. Android常用控件
  9. android用户界面-组件Widget-画廊视图Gallery

随机推荐

  1. jQuery自动完成不适用于多个文本输入
  2. 注册的时候,点击注册按钮,用jquery怎么直接
  3. Send JSON object to Struts 2 action by
  4. jquery 插件bgStretcher 切换背景图片
  5. jquery select(每个)所有选中的复选框?
  6. jquery ajax基本用法
  7. 谷歌地图信息窗口按钮没有显示?
  8. 为什么在使用jquery读写表单输入时必须对
  9. 在Rails应用程序中结合Scriptaculous和JQ
  10. jQuery对象和DOM对象