无法使用TabLayout在RelativeLayout中获取ImageButton上的涟漪效应

问题描述:

ImageButton在其他布局中工作,但对于TabLayout不起作用。我试图用CardView覆盖我的按钮,但它没有帮助。无法使用TabLayout在RelativeLayout中获取ImageButton上的涟漪效应

<RelativeLayout 
    android:id="@+id/rl_tab_container" 
    android:layout_width="match_parent" 
    android:layout_height="@dimen/standard_bar_height" 
    > 

    <android.support.design.widget.TabLayout 
     android:id="@+id/tabs_dict" 
     android:layout_width="match_parent" 
     android:layout_height="match_parent" 
     app:tabGravity="center" 
     app:tabSelectedTextColor="@color/colorBlack87" 
     app:tabTextColor="@color/colorBlack54" 
     app:tabIndicatorColor="@color/colorBlack87" 
     android:background="@color/colorPrimary" 
     /> 

    <ImageButton 
     android:id="@+id/button_delete_all_curr_dict" 
     android:layout_width="48dp" 
     android:layout_height="48dp" 
     android:src="@drawable/ic_delete" 
     android:layout_alignParentEnd="true" 
     android:layout_centerVertical="true" 
     android:layout_marginEnd="8dp" 
     android:background="?attr/selectableItemBackgroundBorderless" 
     /> 
</RelativeLayout> 
+0

你有什么期望的输出?你可以给一个图像吗? – FAT

试试这个在您的ImageButton

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