我想创建一个圆角右下角和右上方角落的自定义按钮。搞砸圆角
不过,我得到左下方和右上方圆润,而不是,虽然我的实现似乎是确定。
我在做什么错?存储在文件夹中抽拉
我使用以下形状的定义:
button_shape.xml
<?xml version="1.0" encoding="utf-8"?>
<shape
xmlns:android="http://schemas.android.com/apk/res/android"
android:shape="rectangle">
<solid android:color="#F66622"/>
<padding
android:left="5dip"
android:top="5dip"
android:right="5dip"
android:bottom="5dip"
/>
<corners
android:radius="20dip"
android:bottomLeftRadius="0dip"
android:topLeftRadius="0dip"
/>
</shape>
和布局文件是这样的:
main.xml中
<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:background="@drawable/bg"
>
<Button
android:id="@+id/btnFoo"
android:text="@string/btn_foo_title"
android:background="@drawable/button_shape"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:layout_margin="5dip"
android:layout_centerInParent="true"
android:textSize="26sp"
/>
</RelativeLayout>
这是结果:
messed corners http://img715.imageshack.us/img715/5954/corners.png
我也试图在button_shape文件
...
<corners
android:bottomLeftRadius="0dip"
android:topLeftRadius="0dip"
android:bottomRightRadius="20dip"
android:topRightRadius="20dip"
/>
...
单独定义每个角半径...同样的结果。
这种功能有可能在Android SDK中出现某种程度的混乱吗?
我怀疑它的功能搞砸了!做项目 - >清洁,看看它是否能解决问题。 – Raunak
我试过了,根本没有帮助。 – Tomas