• android 各种布局技术


    RelativeLayout:

    “<?xml version="1.0" encoding="utf-8"?>
    <RelativeLayoutxmlns:android="http://schemas.android.com/apk/res/android
                    android:layout_width="
    fill_parent"
                    android:layout_height="
    wrap_content"
                    android:background="
    @drawable/blue"
                    android:padding="
    10px" >

       
    <TextViewandroid:id="@+id/label"
                 
    android:layout_width="fill_parent"
                 
    android:layout_height="wrap_content"
                 
    android:text="Type here:"/>

       
    <EditTextandroid:id="@+id/entry"
                 
    android:layout_width="fill_parent"
                 
    android:layout_height="wrap_content"
                 
    android:background="@android:drawable/editbox_background"
                 
    android:layout_below="@id/label"/>
     
       
    <Buttonandroid:id="@+id/ok"
               
    android:layout_width="wrap_content"
               
    android:layout_height="wrap_content"
               
    android:layout_below="@id/entry"
               
    android:layout_alignParentRight="true"
               
    android:layout_marginLeft="10px"
               
    android:text="OK"/>

       
    <Buttonandroid:layout_width="wrap_content"
               
    android:layout_height="wrap_content"
               
    android:layout_toLeftOf="@id/ok"
               
    android:layout_alignTop="@id/ok"
               
    android:text="Cancel"/>
    </RelativeLayout>

    2.tableLayout

    “<?xml version="1.0" encoding="utf-8"?>
    <TableLayoutxmlns:android="http://schemas.android.com/apk/res/android"
       
    android:layout_width="fill_parent"
       
    android:layout_height="fill_parent"
       
    android:stretchColumns="1">
       
    <TableRow>
           
    <TextView
               
    android:text="@string/table_layout_4_open"
               
    android:padding="3dip"/>
           
    <TextView
               
    android:text="@string/table_layout_4_open_shortcut"
               
    android:gravity="right"
               
    android:padding="3dip"/>
       
    </TableRow>

       
    <TableRow>
           
    <TextView
               
    android:text="@string/table_layout_4_save"
               
    android:padding="3dip"/>
           
    <TextView
               
    android:text="@string/table_layout_4_save_shortcut"
               
    android:gravity="right"
               
    android:padding="3dip"/>
       
    </TableRow>
    </TableLayout>

    3.FrameLayout

    框架布局

    “<?xml version="1.0" encoding="utf-8"?>

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

       
    android:layout_width="fill_parent"

       
    android:layout_height="fill_parent"

       
    android:stretchColumns="1">

    <ImageView

     android:layout_width="fill_parent"

    android:layout_height="fill_parent"

    android:src="@drawable/movie"

    />

    <ImageView

    android:layout_width="wrap_content"

    android:layout_height="wrap_content"

    android:src="@drawable/play"

    android:layout_gravity="center"

    />

    </FrameLayout>

  • 相关阅读:
    [IOI1998] Pictures
    【C++】位操作(3)-获取某位的值
    PAT A 1013. Battle Over Cities (25)【并查集】
    hihoCoder 1391 Countries【预处理+排序+优先队列】2016北京网络赛
    PAT A 1014. Waiting in Line (30)【队列模拟】
    codeforces Round#379 div.2
    PAT A 1004. Counting Leaves (30)【vector+dfs】
    POJ 1163:The Triangle
    LeetCode39/40/22/77/17/401/78/51/46/47/79 11道回溯题(Backtracking)
    BZOJ 3680 吊打XXX
  • 原文地址:https://www.cnblogs.com/goldeneast/p/3167220.html
Copyright © 2020-2023  润新知