• 【android】 判断文件是否存在,ImageView scaletype


    判断文件是否存在:

    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.
    大体意思为:一些缩放边界来控制图片视图的界限范围的选项

    CENTER
    Center the image in the view, but perform no scaling.
    按图片的原来size居中显示,当图片长/宽超过View的长/宽,则截取图片的居中部分显示.
    
    CENTER_CROP
    Scale 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_INSIDE
    Scale 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_CENTER
    Scale the image using CENTER.
    把图片按比例扩大/缩小到View的宽度,居中显示
    
    FIT_END
    Scale the image using END.
    把图片按比例扩大/缩小到View的宽度,显示在View的下部分位置
    
    FIT_START
    Scale the image using START.
    把图片按比例扩大/缩小到View的宽度,显示在View的上部分位置
    
    FIT_XY
    Scale the image using FILL.
    把图片不按比例 扩大/缩小到View的大小显示
    
    MATRIX
    Scale using the image matrix when drawing.
    用矩阵来绘制
  • 相关阅读:
    为Fiddler增加Burp-like Inspector扩展 实现类似Burpsuite爆破、一键重放、编码转换等功能
    SVN常见问题总结一
    手把手教你学SVN
    js基本语法汇总
    最全的常用正则表达式大全
    CSS padding margin border属性详解
    从零开始学习jQuery (五) 事件与事件对象
    js正则表达式语法
    浏览器内部工作原理
    原生AJAX入门讲解(含实例)
  • 原文地址:https://www.cnblogs.com/549294286/p/2628026.html
Copyright © 2020-2023  润新知