我的一个Fragment中,加载了一个1024*1024的图片,非常卡。解决办法

1. 将图片改为512*512

2. 异步加载。

final SmartImageView mizige = (SmartImageView)view.findViewById(R.id.mizige);
        // Set the image asynchronous, this avoid the UI being no response.
        new AsyncTask<String, Void, Bitmap>() {
            @Override
            protected Bitmap doInBackground(String... paras) {
                return BitmapFactory.decodeResource(getActivity().getResources(), R.drawable.linmo_mizige);
            }

            @Override
            protected void onPostExecute(Bitmap bitmap) {
                mizige.setImageBitmap(bitmap);
            }
        }.execute();

 

==

相关文章:

  • 2021-05-01
  • 2022-01-01
  • 2022-12-23
  • 2022-12-23
  • 2022-02-24
  • 2021-07-22
  • 2022-01-10
  • 2022-12-23
猜你喜欢
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2021-06-28
  • 2022-12-23
相关资源
相似解决方案