zoukankan      html  css  js  c++  java
  • android中Imageview的布局和使用

    布局:

     <ImageView
            android:id="@+id/imt_photo"
            android:layout_width="fill_parent"
            android:layout_height="fill_parent"
           android:layout_marginLeft="0dp"
           android:layout_marginRight="0dp"
            android:layout_marginTop="0dp" >
        </ImageView>

    初始化和简单的使用:

    private ImageView imageView;
        imageView= (ImageView) findViewById(R.id.imt_photo);
        imageView.setImageBitmap(pic); // 这个ImageView是拍照完成后显示图片
    
        private static String photoPath = "/sdcard/AnBo/";
        private static String photoName = photoPath + "laolisb.jpg";
        BitmapFactory.Options op = new BitmapFactory.Options();
        op.inSampleSize = 4; // 这个数字越大,图片大小越小,越不清晰
        Bitmap pic = null;
        pic = BitmapFactory.decodeFile(photoName, op);   //从指定的地方获取图片
        imageView.setImageBitmap(pic); //显示图片信息
  • 相关阅读:
    设计模式
    idea多个项目
    多个tomcat配置
    mysql数据库默认时间字段格式
    读取文件
    上传图片
    数据库创建用户授权
    统计12个月份的数据
    行列转换
    分页
  • 原文地址:https://www.cnblogs.com/mlgm/p/9686499.html
Copyright © 2011-2022 走看看