阅读更多

--------------------------------------------线性布局LineLayout----------------------------------

<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"

    xmlns:tools="http://schemas.android.com/tools"

    android:id="@+id/LinearLayout1"

    android:layout_width="match_parent"

    android:layout_height="match_parent"

    android:orientation="vertical" >

 

    <TextView

        android:layout_width="fill_parent"

        android:layout_height="wrap_content"

        android:background="#ff0000"

        android:text="@string/hello_world"

        tools:context=".MainActivity" />

 

    <LinearLayout

        android:layout_width="fill_parent"

        android:layout_height="fill_parent"

        android:orientation="horizontal" >

 

        <TextView

            android:layout_width="fill_parent"

            android:layout_height="fill_parent"

            android:layout_weight="2"

            android:background="#00ff00"

            android:text="用户名:" />

 

        <TextView

            android:layout_width="fill_parent"

            android:layout_height="fill_parent"

            android:layout_weight="1"

            android:background="#0000ff"

            android:text="200" />

    LinearLayout>

 

LinearLayout>

--------------------------------------------框架布局FrameLayout-------------------------------

<FrameLayout xmlns:android="http://schemas.android.com/apk/res/android"

    xmlns:tools="http://schemas.android.com/tools"

    android:id="@+id/FrameLayout1"

    android:layout_width="match_parent"

    android:layout_height="match_parent" >

 

    <TextView

        android:layout_width="fill_parent"

        android:layout_height="fill_parent"

        android:background="#ff0000"

        android:text="@string/hello_world"

        tools:context=".MainActivity" />

 

    <TextView

        android:layout_width="300dp"

        android:layout_height="300dp"

        android:layout_weight="1"

        android:background="#00ff00"

        android:text="100" />

 

    <TextView

        android:layout_width="150dp"

        android:layout_height="150dp"

        android:layout_weight="2"

        android:background="#0000ff"

        android:text="200" />

 

FrameLayout>

--------------------------------------------表格布局TableLayout--------------------------------

<TableLayout xmlns:android="http://schemas.android.com/apk/res/android"

    xmlns:tools="http://schemas.android.com/tools"

    android:id="@+id/TableLayout1"

    android:layout_width="match_parent"

    android:layout_height="match_parent"

    android:orientation="vertical" >

 

    <TableRow

        android:layout_width="fill_parent"

        android:layout_height="wrap_content" >

 

        <TextView

            android:layout_width="fill_parent"

            android:layout_height="wrap_content"

            android:layout_weight="2"

            android:background="#ff0000"

            android:text="1000" />

 

        <TextView

            android:layout_width="fill_parent"

            android:layout_height="wrap_content"

            android:layout_weight="1"

            android:background="#00ff00"

            android:text="2000" />

 

        <TextView

            android:layout_width="fill_parent"

            android:layout_height="wrap_content"

            android:layout_weight="2"

            android:background="#0000ff"

            android:text="3000" />

    TableRow>

 

    <TableRow

        android:layout_width="fill_parent"

        android:layout_height="wrap_content" >

 

        <TextView

            android:layout_width="fill_parent"

            android:layout_height="wrap_content"

            android:layout_weight="2"

            android:background="#0000ff"

            android:text="1000" />

 

        <TextView

            android:layout_width="fill_parent"

            android:layout_height="wrap_content"

            android:layout_weight="1"

            android:background="#00ff00"

            android:text="2000" />

    TableRow>

 

TableLayout>

--------------------------------------------相对布局RelativeLayout-----------------------------

<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"

    xmlns:tools="http://schemas.android.com/tools"

    android:id="@+id/RelativeLayout1"

    android:layout_width="match_parent"

    android:layout_height="match_parent"

    android:orientation="vertical" >

 

    <TextView

        android:id="@+id/red"

        android:layout_width="150dp"

        android:layout_height="100dp"

        android:layout_centerInParent="true"

        android:background="#ff0000"

        android:gravity="center"

        android:text="@string/hello_world"

        tools:context=".MainActivity" />

 

    <TextView

        android:id="@+id/green"

        android:layout_width="150dp"

        android:layout_height="100dp"

        android:layout_above="@id/red"

        android:layout_alignBaseline="@id/red"

        android:layout_centerInParent="true"

        android:background="#00ff00"

        android:text="100" />

 

    <TextView

        android:id="@+id/blue"

        android:layout_width="50dp"

        android:layout_height="100dp"

        android:layout_above="@id/red"

        android:layout_toLeftOf="@id/green"

        android:background="#0000ff"

        android:text="200" />

 

RelativeLayout>

--------------------------------------------绝对布局AbsoluteLayout-----------------------------

<AbsoluteLayout xmlns:android="http://schemas.android.com/apk/res/android"

    xmlns:tools="http://schemas.android.com/tools"

    android:id="@+id/AbsoluteLayout1"

    android:layout_width="match_parent"

    android:layout_height="match_parent" >

 

    <TextView

        android:id="@+id/red"

        android:layout_width="150dp"

        android:layout_height="100dp"

        android:layout_x="0dp"

        android:layout_y="100dp"

        android:background="#ff0000"

        android:gravity="center"

        android:text="@string/hello_world"

        tools:context=".MainActivity" />

 

    <TextView

        android:id="@+id/green"

        android:layout_width="150dp"

        android:layout_height="100dp"

        android:layout_x="0sp"

        android:layout_y="200sp"

        android:background="#00ff00"

        android:text="100" />

 

    <TextView

        android:id="@+id/blue"

        android:layout_width="50dp"

        android:layout_height="100dp"

        android:layout_x="0sp"

        android:layout_y="300sp"

        android:background="#0000ff"

        android:text="200" />

 

AbsoluteLayout>

线性布局LineLayout--------------------------------

框架布局FrameLayout------------------------------

表格布局TableLayout-------------------------------

相对布局RelativeLayout----------------------------

绝对布局AbsoluteLayout---------------------------

 

  • 下周内容.pdf (2.3 MB)
  • 下载次数: 10
  • 大小: 93.5 KB
  • 大小: 94.3 KB
  • 大小: 100.4 KB
  • 大小: 96.2 KB
  • 大小: 95.8 KB
  • com.ch05.rar (687.5 KB)
  • 下载次数: 8
  • szFemaleFriends.rar (825.3 KB)
  • 下载次数: 19
  • 注册_登录_我的资料.rar (563.1 KB)
  • 下载次数: 7
  • 查看图片附件

更多相关文章

  1. android获取文件大小常用类
  2. android.view.InflateException报错
  3. android listView性能优化
  4. (自定义)AlertDialog使用
  5. Android中ListView,SQLite,BaseAdapter的结合
  6. Android(安卓)深入理解Android中的自定义属性
  7. Android(安卓)屏幕旋转问题
  8. Android开源项目集合
  9. oauth 授权显示无权访问页面问题的解决方法

随机推荐

  1. android 测试
  2. 【Android】选项卡使用
  3. Android(安卓)webview HitTestResult识别
  4. Android Launcher3去除应用列表,二级菜单,
  5. ViewPagerIndicator使用
  6. Android Studio 调试工具常见问题
  7. React Native與Android交互
  8. android 获取以太网的连接状态
  9. Android中如何获得本机号码信息
  10. 整理一下Android中的ListView