开发学院手机开发Android 开发 Android 实现图片的圆角,倒影,转换 阅读

Android 实现图片的圆角,倒影,转换

 2010-11-05 00:54:52 来源:WEB开发网   
核心提示:import android.os.Bundle;import android.widget.ImageView;public class Imagedemo extends Activity {private ImageView mImageView01,mImageView02;public void onCrea

import android.os.Bundle;

import android.widget.ImageView;

public class Imagedemo extends Activity {

private ImageView mImageView01,mImageView02;

public void onCreate(Bundle savedInstanceState) {

super.onCreate(savedInstanceState);

setContentView(R.layout.main);

setupViews();

}

private void setupViews(){

mImageView01 = (ImageView)findViewById(R.id.image01);

mImageView02 = (ImageView)findViewById(R.id.image02);

//获取壁纸返回值是Drawable

Drawable drawable = getWallpaper();

//将Drawable转化为Bitmap

Bitmap bitmap = ImageUtil.drawableToBitmap(drawable);

//缩放图片

Bitmap zoomBitmap = ImageUtil.zoomBitmap(bitmap, 100, 100);

//获取圆角图片

Bitmap roundBitmap = ImageUtil.getRoundedCornerBitmap(zoomBitmap, 10.0f);

//获取倒影图片

Bitmap reflectBitmap = ImageUtil.createReflectionImageWithOrigin(zoomBitmap);

//这里可以让Bitmap再转化为Drawable

// Drawable roundDrawable = new BitmapDrawable(roundBitmap);

// Drawable reflectDrawable = new BitmapDrawable(reflectBitmap);

// mImageView01.setBackgroundDrawable(roundDrawable);

// mImageView02.setBackgroundDrawable(reflectDrawable);

mImageView01.setImageBitmap(roundBitmap);

mImageView02.setImageBitmap(reflectBitmap);

}

}

上一页  2 3 4 5 6 7 

Tags:Android 实现 图片

编辑录入:coldstar [复制链接] [打 印]
[]
  • 好
  • 好的评价 如果觉得好,就请您
      0%(0)
  • 差
  • 差的评价 如果觉得差,就请您
      0%(0)
赞助商链接