学习导图

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

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

 典型案例(梅花)

<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout
    xmlns:android="http://schemas.android.com/apk/res/android"                             android的布局-----RelativeLayout(相对布局)
    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>

 

相关文章:

  • 2021-11-30
  • 2021-11-30
  • 2021-12-10
  • 2021-12-10
  • 2022-01-11
  • 2021-11-30
  • 2021-12-10
  • 2021-12-10
猜你喜欢
  • 2021-08-13
  • 2021-11-30
  • 2021-12-10
  • 2021-12-10
  • 2022-12-23
  • 2021-11-30
相关资源
相似解决方案