android 項目學習隨筆八(xUtils的BitmapUtils模組)

來源:互聯網
上載者:User

標籤:slist   android   pos   取圖   contain   color   配置   raw   container   

xUtils的BitmapUtils模組:

  • 載入bitmap的時候無需考慮bitmap載入過程中出現的oom和android容器快速滑動時候出現的圖片錯位等現象;
  • 支援載入網狀圖片和本地圖片;
  • 記憶體管理使用lru演算法,更好的管理bitmap記憶體;
  • 可配置線程載入線程數量,緩衝大小,緩衝路徑,載入顯示動畫等...
public Object instantiateItem(ViewGroup container, int position) {            ImageView view = new ImageView(mActivity);            view.setScaleType(ScaleType.FIT_XY);// 設定圖片填充效果, 表示填充父表單            // 擷取圖片連結, 使用連結下載圖片, 將圖片設定給ImageView, 考慮記憶體溢出問題, 圖片本機快取            mBitmapUtils.display(view, mTopNewsList.get(position).topimage);            container.addView(view);            return view;        }

 預設載入圖片(在網路請求圖片下載前顯示的圖片)

public TopNewsAdapter() {            // 初始化xutils中的載入圖片的工具            mBitmapUtils = new BitmapUtils(mActivity);            // 設定預設載入圖片            mBitmapUtils                    .configDefaultLoadingImage(R.drawable.topnews_item_default);        }

 

android 項目學習隨筆八(xUtils的BitmapUtils模組)

聯繫我們

該頁面正文內容均來源於網絡整理,並不代表阿里雲官方的觀點,該頁面所提到的產品和服務也與阿里云無關,如果該頁面內容對您造成了困擾,歡迎寫郵件給我們,收到郵件我們將在5個工作日內處理。

如果您發現本社區中有涉嫌抄襲的內容,歡迎發送郵件至: info-contact@alibabacloud.com 進行舉報並提供相關證據,工作人員會在 5 個工作天內聯絡您,一經查實,本站將立刻刪除涉嫌侵權內容。

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.