zoukankan      html  css  js  c++  java
  • 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>

  • 相关阅读:
    Application
    Intent
    C#Winform实现自动更新
    Activity的四种启动模式
    小白学Python——用 百度翻译API 实现 翻译功能
    小白学Python——用 百度AI 实现 OCR 文字识别
    小白学Python——Matplotlib 学习(3) 函数图形
    小白学Python——Matplotlib 学习(2):pyplot 画图
    小白学Python——Matplotlib 学习(1)
    小白学Python(20)—— Turtle 海龟绘图
  • 原文地址:https://www.cnblogs.com/goldeneast/p/3167220.html
Copyright © 2011-2022 走看看