1500字范文,内容丰富有趣,写作好帮手!
1500字范文 > android 加载图片进度条 ImageView上的Android进度条

android 加载图片进度条 ImageView上的Android进度条

时间:2020-01-12 08:36:54

相关推荐

android 加载图片进度条 ImageView上的Android进度条

我正在开发一个应用程序,用户将从相机拍摄图片并将其显示在具有图像视图的预览屏幕上.

**CameraCapture.java**

class ButtonClickHandler implements View.OnClickListener

{

public void onClick( View view ){

myVib.vibrate(50);

startCameraActivity();

}

}

protected void startCameraActivity()

{

File filenew = new File( _path );

Uri outputFileUri = Uri.fromFile( filenew );

Intent intent = new Intent(android.provider.MediaStore.ACTION_IMAGE_CAPTURE );

intent.putExtra( MediaStore.EXTRA_OUTPUT, outputFileUri );

intent.addFlags(Intent.FLAG_ACTIVITY_NO_ANIMATION);

startActivityForResult( intent, 0 );

}

@Override

protected void onActivityResult(int requestCode, int resultCode, Intent data)

{

switch( resultCode )

{

case 0:

break;

case -1:

//pictaken++;

onPhotoTaken();

break;

}

}

protected void onPhotoTaken()

{

//pictaken=true;

Intent i = new Intent(CameraCapture.this,Preview.class);

startActivity(i);

}

在我的预览类中,捕获的图像显示在ImageView上

**Preview.java**

File imgFile = new File("/sdcard/DCIM/Camera/test.jpg");

if(imgFile.exists()){

// Bitmap myBitmap = BitmapFactory.decodeFile(imgFile.getAbsolutePath());

ImageView myImage = (ImageView) findViewById(R.id.image);

Bitmap myBitmap = BitmapFactory.decodeFile(imgFile.getAbsolutePath());

Matrix mat = new Matrix();

String degree="90";

mat.postRotate(Integer.parseInt(degree));

Bitmap bMapRotate = Bitmap.createBitmap(myBitmap, 0, 0,myBitmap.getWidth(),myBitmap.getHeight(), mat, true);

myImage.setImageBitmap(bMapRotate);

//myImage.setImageBitmap(myBitmap);

}

_image = ( ImageView ) findViewById( R.id.image );

有没有办法在ImageView上显示进度条,直到从SD卡加载Captured图像.

Thnx提前:)

本内容不代表本网观点和政治立场,如有侵犯你的权益请联系我们处理。
网友评论
网友评论仅供其表达个人看法,并不表明网站立场。