Android布局中的不规则形状

时间:2015-04-02 12:10:05

标签: android layout oval

任何想法如何布局这些,以便它们可以点击按钮?

Image of buttons in an ellipsis layout.

1 个答案:

答案 0 :(得分:0)

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

我认为这样你就可以达到目的enter image description here

尝试下面的布局

<?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>