如何在图层列表中制作阴影? [英] How to make shadow in layer-list?

查看:100
本文介绍了如何在图层列表中制作阴影?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

问题如下:我需要在应用小部件中添加一些操作栏,如下所示:

The problem is as follows: I need to make in app widget some actionbar like this:

为此,我将图层列表与形状配合使用.

For this I use layer-list with shape.

<?xml version="1.0" encoding="utf-8"?>

<!-- Bottom 2dp Shadow -->

<item>
    <shape  android:shape="rectangle">
        <solid android:color="#027668"/>
        <corners android:radius="12dp"/>
    </shape>
</item>

<!-- White Top color -->
<item android:bottom="4dp">
    <shape  android:shape="rectangle">
        <solid android:color="#20a18b" />
        <corners android:radius="7dp" />
    </shape>

</item>

我得到一些看法:

但是,我不能像本文中的第一张图片那样在阴影周围做一些事情.

but, I cant do some around shadow like on first image in this post.

该怎么做?

推荐答案

在这里:

<?xml version="1.0" encoding="utf-8"?><!-- Bottom 2dp Shadow -->
<layer-list xmlns:android="http://schemas.android.com/apk/res/android">
    <item>
        <shape android:shape="rectangle">
            <solid android:color="#027668" />
            <corners android:radius="12dp" />
        </shape>
    </item>

    <!-- White Top color -->
    <item android:bottom="4dp">
        <shape android:shape="rectangle">
            <solid android:color="#20a18b" />
            <corners android:radius="7dp" />
            <stroke
                android:width="2dp"
                android:color="#027668" />
        </shape>

    </item>
</layer-list>

结果

这篇关于如何在图层列表中制作阴影?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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