我使用的是9补丁产生阴影的框。如果图像宽度为280dp(20dp离禁区边缘),我得到一个不错的阴影(@ 315度):
I'm using 9-patch to produce drop shadow for a box. If the image width is at 280dp (20dp off the edge of the box), I get a good drop shadow (@315 degrees):
不过,如果我让影像触摸框边缘,右边缘的阴影几乎消失了:
However, if I make the image touch the box edge, the shadow on the right edge almost disappears:
下面是我的布局:
<RelativeLayout
xmlns:android="http://schemas.android.com/apk/res/android"
android:orientation="vertical"
android:layout_width="match_parent"
android:layout_height="300dp"
android:background="@drawable/dropshadow">
<ImageView
android:id="@+id/frontimage"
android:layout_width="match_parent"
android:layout_height="130dp"
android:layout_alignParentTop="true"
android:scaleType="center"
/>
...
</RelativeLayout>
下面是9补丁我使用:
有谁知道为什么会这样?
Does anyone know why this is happening?
谢谢!
推荐答案
降低您的顶部和左侧的黑色边框为1像素(拉伸区域)。
Reduce your top and left black border to 1 px (the stretchable area).
像这样:
另外,您还可以减少一些像素的右侧和底部的黑色边框(引入一些填充)。
Optionally, you can also reduce the right and bottom black border by some pixels (to introduce some padding).
像这样:
另外,您可以添加一些空白(透明)的空间(假设每边4像素)的图像(包括阴影)和黑色边框之间。 这将增加一些填充。
Optionally, you can add some blank (transparent) space (let's say 4px per side) between the image (shadow included) and the black borders. This will add some padding.
或
您可以添加一些填充到你的RelativeLayout的
You can add some padding to your RelativeLayout
相关推荐
最新文章