[英]How to add a drop shadow to a Rectangular Shape in Android
我正在开发一个Android应用程序,其中需要使用应该具有drop_shadow的矩形形状。 我已经设计了一个矩形形状,但是以某种方式我无法在其(右侧和左侧)上添加阴影。 PS:此矩形形状被添加为背景属性。
如果已经回答了此类问题,请在此处提供链接。
先感谢您!!!!
码:
<?xml version="1.0" encoding="utf-8"?>
<shape xmlns:android="http://schemas.android.com/apk/res/android">
<solid android:color="#ffffff" />
<stroke
android:width="1dp"
android:color="#000000" />
<corners
android:radius="10dp" >
</corners>
</shape>
尝试这个:
<?xml version="1.0" encoding="utf-8"?>
<layer-list
xmlns:android="http://schemas.android.com/apk/res/android">
<item>
<shape android:shape="rectangle">
<solid android:color="#CABBBBBB"/>
<corners android:radius="2dp" />
</shape>
</item>
<item
android:left="0dp"
android:right="1dp"
android:top="0dp"
android:bottom="2dp">
<shape android:shape="rectangle">
<solid android:color="@android:color/white"/>
<corners android:radius="1dp" />
</shape>
</item>
</layer-list>
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.