我正在尝试构建带有圆角的Android按钮。但是在圆角(左下角和右下角)周围会出现不必要的灰色阴影。
这是我的代码:
drawable/my_button.xml
<?xml version="1.0" encoding="utf-8"?>
<selector xmlns:android="http://schemas.android.com/apk/res/android">
<item>
<shape android:shape="rectangle">
<stroke android:width="1dp" android:color="#ffa6c575" />
<solid android:color="#ffa6c575"/>
<corners android:radius="15dp" />
</shape>
</item>
</selector>
那么在布局xml文件中,我有:
<LinearLayout
<Button
android:id="@+id/buy_button"
android:layout_width="0dp"
android:layout_weight="1"
android:layout_height="35dp"
android:layout_gravity="center"
android:background="@drawable/my_button"
android:textColor="@android:color/white"
android:text="BUY" />
<View
android:layout_width="10dp"
android:layout_height="match_parent"
android:background="@android:color/transparent" >
</View>
<Button
android:id="@+id/sell_button"
android:layout_width="0dp"
android:layout_weight="1"
android:layout_height="35dp"
android:layout_gravity="center"
android:background="@drawable/my_button"
android:textColor="@android:color/white"
android:text="SELL" />
</LinearLayout>
1) 我该如何去掉圆角周围(左下和右下角)多余的灰色阴影?
2) 按钮有默认的涟漪效果。我该如何保持默认的涟漪效果?
style="?android:attr/borderlessButtonStyle"
解决了它。有人知道如何恢复默认的涟漪效果吗? - Shuwn Yuan Tee