你好,有灰度图像背景的方法吗?我实现了灰度图像本身,但不是背景:/。
我的 GridView 获取视图:
// create a new ImageView for each item referenced by the Adapter
public View getView(int position, View convertView, ViewGroup parent) {
ImageView imageView;
if (convertView == null) { // if it's not recycled, initialize some attributes
imageView = new ImageView(mContext);
imageView.setLayoutParams(new GridView.LayoutParams(65, 65));
imageView.setScaleType(ImageView.ScaleType.CENTER_CROP);
imageView.setPadding(13, 13, 13, 13);
} else {
imageView = (ImageView) convertView;
}
ColorMatrix matrix = new ColorMatrix();
matrix.setSaturation(0);
ColorMatrixColorFilter filter = new ColorMatrixColorFilter(matrix);
imageView.setImageResource(MainActivity.mThumbIds.get(position));
imageView.setBackgroundResource(R.drawable.check);
imageView.setColorFilter(filter);
return imageView;
}