我正在尝试升级我的应用程序以融入材料设计。我已经尝试了一些高程和平移元素,并遇到了问题。换句话说,我的圆角按钮有阴影,但阴影仍然有角落。我不确定为什么会出现这种情况。我已经按照定义阴影和剪辑视图教程进行操作,但没有成功解决问题。
以下是xml的样子:
圆角半径为15dp,除了阴影之外,一切看起来都正确。我该怎么解决?
编辑:这只是在Eclipse的图形布局预览中查看屏幕时出现的问题。一旦在实际设备上加载,它就可以工作了。
以下是xml的样子:
<LinearLayout
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:orientation="vertical"
android:layout_gravity="center">
<Button
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:background="@drawable/standard_button_selector"
android:elevation="2dp"
android:layout_marginBottom="1dp"
/>
这使用了背景选择器:
<?xml version="1.0" encoding="utf-8"?>
<selector xmlns:android="http://schemas.android.com/apk/res/android">
<item android:state_pressed="true">
<shape
android:shape="rectangle">
<solid
android:color="@drawable/button_standard_pressed" />
<corners
android:radius="15dp" />
</shape>
</item>
<item android:state_focused="true" >
<shape
android:shape="rectangle">
<solid
android:color="@drawable/button_standard_focused"/>
<corners
android:radius="15dp" />
</shape>
</item>
<item>
<shape
android:shape="rectangle">
<solid
android:color="@drawable/button_standard_default"/>
<corners
android:radius="15dp" />
</shape>
</item>
</selector>
圆角半径为15dp,除了阴影之外,一切看起来都正确。我该怎么解决?
编辑:这只是在Eclipse的图形布局预览中查看屏幕时出现的问题。一旦在实际设备上加载,它就可以工作了。