Android Action Bar椭圆阴影

时间:2014-12-21 18:25:26

标签: android android-layout svg android-actionbar

我正在尝试将一个投影插入到android操作栏中,如下图所示......有人可以帮助我如何实现这样的投影吗?enter image description here

我尝试使用SVG作为阴影使用android库here,但我无法实现它。

这是投影的svg代码。

<?xml version="1.0" encoding="utf-8"?>
<!-- Generator: Adobe Illustrator 16.0.0, SVG Export Plug-In . SVG Version: 6.00 Build 0)  -->
<!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd">
<svg version="1.1" id="Layer_1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" x="0px" y="0px"
     width="640.036px" height="3.565px" viewBox="0 0 640.036 3.565" enable-background="new 0 0 640.036 3.565" xml:space="preserve">
<g opacity="0.6">

        <image overflow="visible" width="2967" height="315" xlink:href="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAC58AAAE9CAYAAAA2mTf1AAAACXBIWXMAAC4jAAAuIwF4pT92AAAA
GXRFWHRTb2Z0d2FyZQBBZG9iZSBJbWFnZVJlYWR5ccllPAAAFmlJREFUeNrs3d9vHMUBB/CZ3bMd
nGASJNKGtFWp1JdK/QOqSn3pCwie4E9DSPwT8ASCl75UqvoHIPUJUUQbUoJEEhO78Y/b6cydA9i+
qDHcnXdnPx/pfD9ebnZ2dnbG/s44BAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA
AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA
AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA
AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA
AAAAAAAAAAAAAAAAAAAAAAA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2AAuplUaT6sEJcAAAAASUVORK5CYII=" transform="matrix(0.24 0 0 0.24 -36 -36)">
    </image>
</g>
</svg>

提前致谢

1 个答案:

答案 0 :(得分:1)

感谢Der Golem我通过使用XML drawable找到了解决此问题的方法......以下是获取椭圆投影的解决方案。

<?xml version="1.0" encoding="utf-8"?>
<layer-list xmlns:android="http://schemas.android.com/apk/res/android">
    <item>
        <rotate
            android:fromDegrees="180"
            android:pivotY="15%"
            android:toDegrees="0">

            <shape android:shape="oval">
                <solid
                    android:color="#ff000000"></solid>
            </shape>
        </rotate>
    </item>
</layer-list>