zoukankan      html  css  js  c++  java
  • 从头学Android之RelativeLayout相对布局

    http://blog.csdn.net/worker90/article/details/6893246

    相对布局对于做Web开发来说再熟悉不过了,我们在用CSS+DIV的时候经常会用到这些类似的相对布局的,在设置某个DIV的位置的时候,我们时常会以一个DIV作为参考来设置的位置,废话不多说,直接看属性看实例。

    属性名称

    描述

    android:layout_below

    摆放在指定组件的下边

    android:layout_toLeftOf

    摆放在指定组件的左边

    android:layout_toRightOf

    摆放在指定组件的右边

    android:layout_alignTop

    以指定组件作为参考进行上对齐

    android:layout_algnBottom

    以指定组件作为参照进行下对齐

    android:layout_alignLeft

    以指定组件作为参考进行左对齐

    android:layout_alignRight

    以指定组件

    以上一节的例子再做一个相对布局实现的例子

     相对布局对于做Web开发来说再熟悉不过了,我们在用CSS+DIV的时候经常会用到这些类似的相对布局的,在设置某个DIV的位置的时候,我们时常会以一个DIV作为参考来设置的位置,废话不多说,直接看属性看实例。

    属性名称

    描述

    android:layout_below

    摆放在指定组件的下边

    android:layout_toLeftOf

    摆放在指定组件的左边

    android:layout_toRightOf

    摆放在指定组件的右边

    android:layout_alignTop

    以指定组件作为参考进行上对齐

    android:layout_algnBottom

    以指定组件作为参照进行下对齐

    android:layout_alignLeft

    以指定组件作为参考进行左对齐

    android:layout_alignRight

    以指定组件

    以上一节的例子再做一个相对布局实现的例子

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

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

    android:orientation="vertical" android:layout_width="fill_parent"

    android:layout_height="wrap_content">

    <EditText android:layout_width="wrap_content"

    android:layout_height="wrap_content" android:layout_alignParentTop="true"

    android:layout_alignParentRight="true" android:layout_toRightOf="@+id/tv_username"

    android:id="@+id/txt_username">

    </EditText>

    <EditText android:layout_width="wrap_content"

    android:layout_height="wrap_content" android:layout_below="@+id/txt_username"

    android:layout_alignLeft="@+id/txt_username"

    android:layout_alignParentRight="true" android:id="@+id/txt_password"></EditText>

    <TextView android:id="@+id/tv_username" android:layout_width="wrap_content"

    android:layout_height="wrap_content" android:text="用户名称"

    android:layout_alignParentTop="true" android:layout_alignParentLeft="true"

    android:layout_marginTop="14dp"></TextView>

    <Button android:text="登录" android:layout_width="wrap_content"

    android:layout_height="wrap_content" android:layout_below="@+id/txt_password"

    android:layout_alignParentRight="true" android:layout_alignLeft="@+id/txt_password"

    android:id="@+id/btn_login"></Button>

    <Button android:text="取消" android:layout_width="wrap_content"

    android:layout_height="wrap_content" android:layout_below="@+id/txt_password"

    android:layout_alignRight="@+id/tv_username" android:id="@+id/btn_cacel"></Button>

    <TextView android:id="@+id/tv_password" android:layout_width="wrap_content"

    android:layout_height="wrap_content" android:text="用户密码"

    android:layout_centerVertical="true" android:layout_toLeftOf="@+id/txt_password"></TextView>

    </RelativeLayout>

    实例效果:

     

    实例效果:

     

  • 相关阅读:
    Window 下配置ChromeDriver(简单4步完成)[转]
    selenium之 chromedriver与chrome版本映射表(更新至v2.46)[转]
    学习网站
    如何理解python中的类和方法(转)
    面试题整理20191127
    mysql 慢查询
    python学习--代码组织实例
    ubuntu下安装Matlab
    SkinPP for VC
    C++中的4个类型转换关键字
  • 原文地址:https://www.cnblogs.com/feng9exe/p/5748523.html
Copyright © 2011-2022 走看看