首页 > 移动平台 > 详细

Android Studio [相对布局RelativeLayout]

时间:2019-04-13 14:13:56      阅读:377      评论:0      收藏:0      [点我收藏+]
<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout
    xmlns:android="http://schemas.android.com/apk/res/android"
    xmlns:tools="http://schemas.android.com/tools"
    xmlns:app="http://schemas.android.com/apk/res-auto"
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    tools:context=".MainActivity">
    
    <View
        android:id="@+id/view_1"
        android:layout_width="100dp"
        android:layout_height="100dp"
        android:background="#000000"
        />
    <View
        android:id="@+id/view_2"
        android:layout_width="100dp"
        android:layout_height="100dp"
        android:background="#fa1919"
        android:layout_below="@id/view_1"
        />
    <LinearLayout

        android:id="@+id/view_3"
        android:layout_width="match_parent"
        android:layout_height="200dp"
        android:layout_below="@id/view_2"
        android:orientation="horizontal"
        android:background="#0b56f9"
        android:padding="15dp">
        <View
            android:layout_width="100dp"
            android:layout_height="match_parent"
            android:background="#fa1919"/>
        <RelativeLayout
            android:layout_width="match_parent"
            android:layout_height="match_parent"
            android:background="#000000"
            android:padding="15dp">
            <View
                android:id="@+id/view_4"
                android:layout_width="100dp"
                android:layout_height="match_parent"
                android:background="#3a75ff"/>
            <View
                android:id="@+id/view_5"
                android:layout_width="100dp"
                android:layout_height="match_parent"
                android:background="#ecd931"
                android:layout_toRightOf="@id/view_4"
                android:layout_marginLeft="15dp"/>
        </RelativeLayout>
    </LinearLayout>

</RelativeLayout>

我学习的

 

 

<RelativeLayout +代码 /></RelativeLayout>
android:layout_toRightOf="此处写id"设定在某个块的右边
结果

技术分享图片

 

Android Studio [相对布局RelativeLayout]

原文:https://www.cnblogs.com/zlc364624/p/10700922.html

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