窗口的布局是在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. Android基本界面控件
  2. 控件(2)toast
  3. android页面用jquery窗口大小获取错误问题的解决
  4. android WindowManager 应用内部悬浮窗口总结
  5. Android在XML中自定义控件的使用
  6. Android弹出软键盘布局是否上移问题
  7. Android 中常用的五种布局

随机推荐

  1. Android---配置adb环境变量
  2. Android parcelable 解析
  3. Android屏幕常亮防息屏
  4. EditText的focus问题
  5. Android的一些开发资料
  6. android 使用Yasea和ijkplayer集成到自己
  7. ContentProvider总结(Android)
  8. Android的init进程是如何启动的
  9. Android Display 之 HAL Gralloc
  10. Android Vold