getResources().getDrawable(rippleResourceId, null) return rippleDrawable 颜色错误

getResources().getDrawable(rippleResourceId, null) return rippleDrawable with the wrong color

我使用 android resourceId android.R.attr.actionBarItemBackground 来设置波纹。

在一项上效果很好。在另一个项目上,我更改了 RippleDrawable 半径,但随后波纹颜色变为粉红色。

    int rippleResourceId = // android.R.attr.actionBarItemBackground from current context
    if (VERSION.SDK_INT >= VERSION_CODES.M) {
      RippleDrawable drawable =
          (RippleDrawable) getResources().getDrawable(rippleResourceId, null);
      drawable.setRadius(
          getContext()
              .getResources()
              .getDimensionPixelSize(R.dimen.ripple_radius));
 myFrameLayout.setBackground(drawable);
    } else {
       myFrameLayout.setBackgroundResource(discRippleResourceId);
    }

怎么有这个问题?

发送空主题导致了这种差异

getDrawable(rippleResourceId, null);