我想構建帶有圓角的Android按鈕。但沿着圓角(右下角的左下角&),它周圍有不需要的灰色陰影。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)按鈕有默認的連鎖效應。我如何維持默認的連鎖效應?
按鈕默認的影子。您可以更改爲TextView,它是Button的基類,具有較少的默認值。 – Emma
對於多餘的邊框問題,我用'style =「?android:attr/borderlessButtonStyle」'解決了它。任何人都有任何想法如何恢復默認的連鎖反應? –