2017-02-27 63 views

回答

6

使用以下代碼。

<?xml version="1.0" encoding="utf-8"?> 
<ripple android:color="@color/COLOR_WHILE_PRESSING" xmlns:android="http://schemas.android.com/apk/res/android"> 
<item android:drawable="@drawable/round_corner"></item> 
</ripple> 

round_corner.xml

<?xml version="1.0" encoding="utf-8"?> 
<shape xmlns:android="http://schemas.android.com/apk/res/android"> 
<solid android:color="@color/BACKGROUND_COLOR" /> 
<corners android:radius="6dp" /> 
</shape> 
+0

這不會使佈局邊框圓角。 –

+0

你在使用卡片視圖嗎? –

+0

我正在使用線性佈局。我想用漣漪效應來完成。 –

0

只是在XML文件中

android:background="?android:attr/selectableItemBackground" 
android:clickable="true" 

應該這樣做設置這些屬性。

+0

這不會使佈局邊角圓。 –

+0

然後嘗試'android:foregroud =「?android:attr/selectableItemBackground」'而不是 –