首页 > 移动平台 > 详细

android的布局-----RelativeLayout(相对布局)

时间:2015-12-30 21:38:38      阅读:230      评论:0      收藏:0      [点我收藏+]

学习导图

技术分享

注:父容器定位的属性值只能是Boolean ,兄弟组件定位的属性值只能是ID

 典型案例(梅花)

<?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">
    <ImageView
        android:id="@+id/img1"
        android:layout_width="150dp"
        android:layout_height="150dp"
        android:layout_centerInParent="true"
        android:src="@mipmap/ic_launcher"/>
    <ImageView
        android:id="@+id/img2"
        android:layout_width="150dp"
        android:layout_height="150dp"
        android:layout_above="@id/img1"
        android:layout_centerHorizontal="true"
        android:src="@mipmap/ic_launcher"/>
    <ImageView
        android:id="@+id/img3"
        android:layout_width="150dp"
        android:layout_height="150dp"
        android:layout_below="@id/img1"
        android:layout_centerHorizontal="true"
        android:src="@mipmap/ic_launcher"/>
    <ImageView
        android:id="@+id/img4"
        android:layout_width="150dp"
        android:layout_height="150dp"
        android:layout_toLeftOf="@id/img1"
        android:layout_centerVertical="true"
        android:src="@mipmap/ic_launcher"/>
    <ImageView
        android:id="@+id/img5"
        android:layout_width="150dp"
        android:layout_height="150dp"
        android:layout_toRightOf="@id/img1"
        android:layout_centerVertical="true"
        android:src="@mipmap/ic_launcher"/>

</RelativeLayout>

 

android的布局-----RelativeLayout(相对布局)

原文:http://www.cnblogs.com/huolan/p/5089399.html

(0)
(0)
   
举报
评论 一句话评论(0
关于我们 - 联系我们 - 留言反馈 - 联系我们:wmxa8@hotmail.com
© 2014 bubuko.com 版权所有
打开技术之扣,分享程序人生!