Bitmap icon = BitmapFactory.decodeResource(getResources(), R.drawable.xxxx)
如果xxxx是selector的话,会返回null。
先是改成
Bitmap mSlideBitmap = ((BitmapDrawable) getResources().getDrawable(R.drawable.xxx)).getBitmap();
catch提示
can't convert StateListDrawable to BitmapDrawable,最后把xxx替换成一般的drawable之后,异常消失,最后改回decodeResource也可以获取成功了。