androidlayoutoval

Irregular shapes in Android layout


Any idea how to layout these so they shape around with click able buttons?

Image of buttons in an ellipsis layout.


Solution

  • The only way to achieve it, Design the layout for the imageviews and add each portion of your image into it and use selector drawable to change image in certain events

    i think this way you can achieve your purpose enter image description here

    try below layout

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