How to blur an image(png) and then load it to image view using setBackgroundResource(R.drawable.*). It must work on API > 10

I have found some solutions, but i don't know how to take image from @drawable and load it to imageview

Thanks in advance...

有帮助吗?

解决方案

these ways to set the image to ImageView

imageView.setImageResource(R.drawable.ic_launcher);

or

imageView.setBackground(getResources().getDrawable(R.drawable.ic_launcher));

or

BitmapDrawable drawable = (BitmapDrawable) getResources().getDrawable(R.drawable.ic_launcher);
imageView.setImageBitmap(drawable.getBitmap());

其他提示

This library does what you are looking for: https://github.com/kikoso/android-stackblur

许可以下: CC-BY-SA归因
不隶属于 StackOverflow
scroll top