2017-12-20 3 views
0

iv_buttonのリップルエフェクトは、ImageViewがwrapper ImageViewにバックグラウンドを設定するまで正常に動作します。これを修正するには?ImageViewがsetBackgroundを持つ別のImageViewをオーバーレイするとリップル効果が失われる

ご協力いただければ幸いです。

<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android" 
    android:layout_width="match_parent" 
    android:layout_height="match_parent" 
    android:orientation="vertical"> 

    <ImageView 
     android:id="@+id/wrapper" 
     android:background="@color/green" //the ripple effect works without this line 
     android:layout_width="match_parent" 
     android:layout_height="match_parent"/> 

    <ImageView 
     android:id="@+id/iv_button" 
     android:layout_width="100dp" 
     android:layout_height="100dp" 
     android:layout_centerInParent="true" 
     android:background="?selectableItemBackgroundBorderless" 
     android:clickable="true" 
     android:src="@android:drawable/ic_delete" /> 

</RelativeLayout> 
+0

この参照先https://stackoverflow.com/questions/31393684/set-ripple-effect-on-image-view – R2R

答えて

0

xmlに背景を設定すると、波紋効果が失われます。それを保持したい場合は、スタイルで設定し、そのスタイルをボタンに与える必要があります。

関連する問題