zoukankan      html  css  js  c++  java
  • ImageView 设置图片来自:http://blog.csdn.net/lincyang/article/details/6562163

    android doc中是这样描述的:
    
    
    
    public void setImageResource (int resId)
    
    这是其中的一个方法,参数resld是这样:
    
    ImageView.setImageResource(R.drawable.icon);
    
     
    
    看下面这段话
    
    
    
    Sets a drawable as the content of this ImageView.
    
    This does Bitmap reading and decoding on the UI thread, which can cause a latency hiccup. If that's a concern, consider usingsetImageDrawable(Drawable) or setImageBitmap(Bitmap) and BitmapFactory instead.
    
     
    
    此函数使用UI线程,可以用下面3种替代:
    
    ImageView iv; 
    
    String fileName = "/data/data/com.test/aa.png; 
    Bitmap bm = BitmapFactory.decodeFile(fileName); 
    iv.setImageBitmap(bm); 
    
    
    ImageView iv = new ImageView(context); 
    iv.setImageResource(iv[position]); 
    iv.setScaleType(ImageView.ScaleType.FIT_XY); 
    iv.setLayoutParams(new Gallery.LayoutParams(136,88)); 
    
    
    mImageView = (ImageView)this.findViewById(R.id.myImageView1); 
    mImageView.setImageDrawable(getResources().getDrawable(R.drawable.right)
  • 相关阅读:
    汇编指令(它不区分大小写)
    汇编
    LINUX命令
    LInux 终端命令
    回文串的Manacher算法
    hdu3336 Counting the string kmp的next数组的应用
    hdu2203kmp匹配
    hdu2087kmp模板练习
    hdu1171kmp果题
    hdu1686kmp果题
  • 原文地址:https://www.cnblogs.com/gisoracle/p/7628992.html
Copyright © 2011-2022 走看看