如何创建此形状可绘制 [英] How to create this shape drawable

查看:85
本文介绍了如何创建此形状可绘制的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想创建可绘制成这种形状的xml

I want to create xml drawable to this shape,

推荐答案

使用此布局并保存在可绘制的文件夹中.....

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"/>

注意:-将宽度和高度设置为wrap_content .....

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

享受编码...........

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

这篇关于如何创建此形状可绘制的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆