WEB开发网
开发学院手机开发Android 开发 Android 图片放大修改代码 阅读

Android 图片放大修改代码

 2010-09-10 00:57:00 来源:WEB开发网   
核心提示:package com.jinyan.TestImage;import java.io.IOException;import java.io.InputStream;import java.net.HttpURLConnection;import java.net.MalformedURLException;impor

package com.jinyan.TestImage;

import java.io.IOException;

import java.io.InputStream;

import java.net.HttpURLConnection;

import java.net.MalformedURLException;

import java.net.URL;

import android.app.Activity;

import android.graphics.Bitmap;

import android.graphics.BitmapFactory;

import android.graphics.Matrix;

import android.graphics.drawable.BitmapDrawable;

import android.graphics.drawable.Drawable;

import android.os.Bundle;

import android.util.Log;

import android.widget.Button;

import android.widget.ImageView;

public class TestImage extends Activity {

/** Called when the activity is first created. */

private static final String tag = "TestImage.............";

String imageUrl = "http://i.pbase.com/o6/92/229792/1/80199697.uAs58yHk.50pxCross_of_the_Knights_Templar_svg.png";

Bitmap bmImg;

ImageView imView;

Button button1;

@Override

public void onCreate(Bundle savedInstanceState) {

super.onCreate(savedInstanceState);

setContentView(R.layout.main);

imView = (ImageView) findViewById(R.id.imview);

imView.setImageBitmap(returnBitMap(imageUrl));

Bitmap bitmap = returnBitMap(imageUrl);

imView.setImageDrawable(resizeImage(bitmap, 600, 600));

}

public Bitmap returnBitMap(String url) {

URL myFileUrl = null;

Bitmap bitmap = null;

try {

myFileUrl = new URL(url);

} catch (MalformedURLException e) {

e.printStackTrace();

}

try {

HttpURLConnection conn = (HttpURLConnection) myFileUrl

.openConnection();

conn.setDoInput(true);

conn.connect();

InputStream is = conn.getInputStream();

1 2  下一页

Tags:Android 图片 放大

编辑录入:coldstar [复制链接] [打 印]
赞助商链接