【android】 判斷檔案是否存在,ImageView scaletype

來源:互聯網
上載者:User

判斷檔案是否存在:

public static boolean isFileExit(String path){        if(path == null){            return false;        }        try{            File f = new File(path);            if(!f.exists()){                return false;            }        }catch (Exception e) {            // TODO: handle exception        }        return true;    }

 

ImageView的 android:scaleType屬性:

http://www.cnblogs.com/chorrysky/archive/2012/05/11/2496107.html

ImageView控制項中有一個android:scaleType屬性。
即ImageView.setScaleType(ImageView.ScaleType)

Sdk中介紹作用為:Options for scaling the bounds of an image to the bounds of this view.

大體意思為:一些縮放邊界來控製圖片視圖的界限範圍的選項

CENTERCenter the image in the view, but perform no scaling.按圖片的原來size置中顯示,當圖片長/寬超過View的長/寬,則截取圖片的置中部分顯示.CENTER_CROPScale the image uniformly (maintain the image's aspect ratio) so that both dimensions (width and height) of the image will be equal to or larger than the corresponding dimension of the view (minus padding).按比例擴大圖片的size置中顯示,使得圖片長(寬)等於或大於View的長(寬)CENTER_INSIDEScale the image uniformly (maintain the image's aspect ratio) so that both dimensions (width and height) of the image will be equal to or less than the corresponding dimension of the view (minus padding).將圖片的內容完整置中顯示,通過按比例縮小或原來的size使得圖片長/寬等於或小於View的長/寬FIT_CENTERScale the image using CENTER.把圖片按比例擴大/縮小到View的寬度,置中顯示FIT_ENDScale the image using END.把圖片按比例擴大/縮小到View的寬度,顯示在View的下部分位置FIT_STARTScale the image using START.把圖片按比例擴大/縮小到View的寬度,顯示在View的上部分位置FIT_XYScale the image using FILL.把圖片不按比例 擴大/縮小到View的大小顯示MATRIXScale using the image matrix when drawing.用矩陣來繪製
相關文章

聯繫我們

該頁面正文內容均來源於網絡整理,並不代表阿里雲官方的觀點,該頁面所提到的產品和服務也與阿里云無關,如果該頁面內容對您造成了困擾,歡迎寫郵件給我們,收到郵件我們將在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.