Android 布局中的不规则形状

Irregular shapes in Android layout

知道如何对这些进行布局,以便它们可以通过可点击的按钮形成形状吗?

实现它的唯一方法,设计 imageviews 的布局并将图像的每个部分添加到其中,并使用选择器 drawable 在某些事件中更改图像

我觉得这样可以达到你的目的

试试下面的布局

<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
    android:orientation="vertical" android:layout_width="match_parent"
    android:layout_height="match_parent">



    <Button
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:layout_centerInParent="true"
        android:text="New Button"/>
    <LinearLayout
        android:layout_width="match_parent"
        android:layout_height="match_parent"
        android:orientation="vertical">
    <LinearLayout
        android:layout_width="match_parent"
        android:layout_height="match_parent"
        android:layout_weight="1"
        android:orientation="horizontal">
    <Button
        android:layout_width="match_parent"
        android:layout_height="match_parent"
        android:text="New Button"
        android:layout_weight="1"
        android:id="@+id/button2"
        android:layout_alignBottom="@+id/button3" />

    <Button
        android:layout_width="match_parent"
        android:layout_height="match_parent"
        android:text="New Button"
        android:layout_weight="1"
        android:id="@+id/button3"
        android:layout_alignParentTop="true" />
    </LinearLayout>
        <LinearLayout
            android:layout_width="match_parent"
            android:layout_height="match_parent"
            android:layout_weight="1"
            android:orientation="horizontal">
            <Button
                android:layout_width="match_parent"
                android:layout_height="match_parent"
                android:text="New Button"
                android:layout_weight="1"
                android:layout_alignBottom="@+id/button3" />

            <Button
                android:layout_width="match_parent"
                android:layout_height="match_parent"
                android:text="New Button"
                android:layout_weight="1"
                android:layout_alignParentTop="true" />
        </LinearLayout>

    </LinearLayout>
</RelativeLayout>