Android学习之--RelativeLayout实例 梅花布局

"http://schemas.android.com/apk/res/android"
    xmlns:tools="http://schemas.android.com/tools"
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    android:paddingBottom="@dimen/activity_vertical_margin"
    android:paddingLeft="@dimen/activity_horizontal_margin"
    android:paddingRight="@dimen/activity_horizontal_margin"
    android:paddingTop="@dimen/activity_vertical_margin"
    tools:context="com.relativalayout.MainActivity">

    "@+id/view1"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:layout_centerInParent="true"
        android:background="@mipmap/ic_launcher" />

    "@+id/view2"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:background="@mipmap/ic_launcher"
        android:layout_above="@+id/view1"
        android:layout_alignLeft="@+id/view1"
        />
    "@+id/view3"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:background="@mipmap/ic_launcher"
        android:layout_below="@+id/view1"
        android:layout_alignLeft="@+id/view1"
        />
    "@+id/view4"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:background="@mipmap/ic_launcher"
        android:layout_toRightOf="@id/view1"
        android:layout_alignBottom="@id/view1"
        />
    "@+id/view5"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:background="@mipmap/ic_launcher"
        android:layout_toLeftOf="@id/view1"
        android:layout_alignBottom="@id/view1"
        />
</RelativeLayout>

你可能感兴趣的:(android)