Android L,ripple effect在Gridview中无法正常工作

Android L,ripple effect在Gridview中无法正常工作,android,gridview,rippledrawable,Android,Gridview,Rippledrawable,我正在使用sdk21并将按钮添加到gridview。然而,不知何故,只有第一个按钮在单击时显示涟漪效应,而其他按钮没有显示 编辑:我发现如果我没有在按钮中添加onClick监听器,就会显示涟漪效应,但是在我添加监听器之后,只有第一个监听器会显示涟漪效应 编辑:嗯,经过进一步的调查,我发现在调用setCompoundDrawableSwithinInstincBounds()后效果消失了 我通过以下方式获得resourceId: TypedArray a = context.obt

我正在使用
sdk21
并将
按钮添加到
gridview
。然而,不知何故,只有第一个按钮在单击时显示涟漪效应,而其他按钮没有显示

编辑:我发现如果我没有在按钮中添加onClick监听器,就会显示涟漪效应,但是在我添加监听器之后,只有第一个监听器会显示涟漪效应

编辑:嗯,经过进一步的调查,我发现在调用setCompoundDrawableSwithinInstincBounds()后效果消失了

我通过以下方式获得resourceId:

        TypedArray a = context.obtainStyledAttributes(attrs, R.styleable.hashtag_button);
        mSelectedResourceId = a.getResourceId(R.styleable.hashtag_button_selected_image, R.drawable.star_selected);
        mUnselectedResourceId = a.getResourceId(R.styleable.hashtag_button_unselected_image, R.drawable.star_unselected);
        a.recycle();
我通过以下方法更改图像:

public void setFavorite(boolean isFavorite) {
    mIsFavorite = isFavorite;
    if (mIsFavorite) { //Favorite
        this.setCompoundDrawablesWithIntrinsicBounds(0, 0, mSelectedResourceId, 0);
    } else { //Not Favorite
        this.setCompoundDrawablesWithIntrinsicBounds(0, 0, mUnselectedResourceId, 0);
    }
}
所以这只导致第一个按钮产生涟漪效应。。。不知道如何解决这个问题

有人有同样的问题吗

谢谢