zoukankan      html  css  js  c++  java
  • 安卓UI四种基本布局-相对布局

    相对服框架布局

    <RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
    android:layout_width="match_parent"
    android:layout_height="match_parent">
    <Button
    android:id="@+id/b1"
    android:layout_alignParentLeft="true"
    android:layout_alignParentTop="true"
    android:layout_width="wrap_content"
    android:layout_height="wrap_content"
    android:text="按钮1"/>
    <Button
    android:id="@+id/b2"
    android:layout_alignParentLeft="true"
    android:layout_alignParentBottom="true"
    android:layout_width="wrap_content"
    android:layout_height="wrap_content"
    android:text="按钮2"/>
    <Button
    android:id="@+id/b3"
    android:layout_alignParentTop="true"
    android:layout_alignParentRight="true"
    android:layout_width="wrap_content"
    android:layout_height="wrap_content"
    android:text="按钮3"/>
    <Button
    android:id="@+id/b4"
    android:layout_alignParentRight="true"
    android:layout_alignParentBottom="true"
    android:layout_width="wrap_content"
    android:layout_height="wrap_content"
    android:text="按钮4"/>
    <Button
    android:id="@+id/b5"
    android:layout_centerInParent="true"
    android:layout_width="wrap_content"
    android:layout_height="wrap_content"
    android:text="按钮5"/>

    </RelativeLayout>

    
    

    相对控件布局

    <?xml version="1.0" encoding="utf-8"?>
    <RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
    android:layout_width="match_parent"
    android:layout_height="match_parent">
    <Button
    android:id="@+id/b5"
    android:layout_centerInParent="true"
    android:layout_width="wrap_content"
    android:layout_height="wrap_content"
    android:text="按钮5"/>
    <Button
    android:id="@+id/b1"
    android:layout_above="@+id/b5"
    android:layout_toLeftOf="@+id/b5"
    android:layout_width="wrap_content"
    android:layout_height="wrap_content"
    android:text="按钮1"/>
    <Button
    android:id="@+id/b2"
    android:layout_above="@+id/b5"
    android:layout_toRightOf="@+id/b5"
    android:layout_width="wrap_content"
    android:layout_height="wrap_content"
    android:text="按钮2"/>
    <Button
    android:id="@+id/b3"
    android:layout_below="@+id/b5"
    android:layout_toLeftOf="@+id/b5"
    android:layout_width="wrap_content"
    android:layout_height="wrap_content"
    android:text="按钮3"/>
    <Button
    android:id="@+id/b4"
    android:layout_below="@+id/b5"
    android:layout_toRightOf="@+id/b5"
    android:layout_width="wrap_content"
    android:layout_height="wrap_content"
    android:text="按钮4"/>


    </RelativeLayout>

    android:layout_alignRight="@+id/b1"指b3的右侧与b1对齐

    <EditText
    android:id="@+id/b3"
    android:layout_below="@+id/b5"
    android:layout_toLeftOf="@+id/b5"
    android:layout_alignRight="@+id/b1"
    android:layout_width="wrap_content"
    android:layout_height="wrap_content"
    android:text="按钮3"/>
  • 相关阅读:
    [Noip2010]乌龟棋
    vijos次小生成树
    hdu3579-Hello Kiki-(扩展欧几里得定理+中国剩余定理)
    hdu1573-X问题-(扩展欧几里得定理+中国剩余定理)
    poj2115-Looooops-(扩展欧几里得定理)
    hdu2669-Romantic-(扩展欧几里得定理)
    poj1061-青蛙的约会-(贝祖定理+扩展欧几里得定理+同余定理)
    hdu1576-A/B-(同余定理+乘法逆元+费马小定理+快速幂)
    hdu4497-GCD and LCM-(欧拉筛+唯一分解定理+组合数)
    hdu3189-Just Do It-(埃氏筛+唯一分解定理)
  • 原文地址:https://www.cnblogs.com/837634902why/p/10308446.html
Copyright © 2011-2022 走看看