How to create this shape drawable

最后都变了- 提交于 2019-12-23 02:33:04

问题


I want to create xml drawable to this shape,


回答1:


use this layout and save in drawable folder.....

<?xml version="1.0" encoding="utf-8"?>
<layer-list xmlns:android="http://schemas.android.com/apk/res/android">

    <item>
        <shape android:shape="rectangle">
            <size
                android:width="200dp"
                android:height="50dp" />
            <solid android:color="#ef45d1" />
            <corners android:topRightRadius="20dp" />
        </shape>
    </item>


    <item
        android:bottom="0dp"
        android:right="165dp"
        android:top="0dp">

        <rotate
            android:fromDegrees="45"
            android:pivotX="0%"
            android:pivotY="0%"
            android:toDegrees="45">

            <shape android:shape="rectangle">
                <solid android:color="#ffffff" />


            </shape>
        </rotate>

    </item>

</layer-list>

and set in your layout view as background....

<Button
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:text="Button"
        android:background="@drawable/newrecatngle"/>

NOTE:-set width and height as wrap_content.....

enjoy coding...........



来源:https://stackoverflow.com/questions/37827506/how-to-create-this-shape-drawable

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!