我有一个Android应用程序,我正在使用Android相机拍照.这张照片是在拍摄activity A
后拍摄的activity B
.
这是我收到我的图像的方式activity B
:
Bundle extras = getIntent().getExtras();
BitmapFactory.Options options=new BitmapFactory.Options();
options.inSampleSize = 5;
byte[] imageData = extras.getByteArray("imageData");
Bitmap myImage = BitmapFactory.decodeByteArray(imageData , 0, imageData.length,options);
Matrix mat=new Matrix();
mat.postRotate(90);
bitmapResult = Bitmap.createBitmap(myImage, 0, 0, myImage.getWidth(), myImage.getHeight(), mat, true);
ImageView imageView = (ImageView) findViewById(R.id.myPic);
imageView.setImageBitmap(bitmapResult);
Run Code Online (Sandbox Code Playgroud)
正如你所看到的那样,bitmap
我用90 旋转我收到的:
Matrix mat=new Matrix();
mat.postRotate(90);
Run Code Online (Sandbox Code Playgroud)
这是我imageView
的xml文件:
<ImageView
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:layout_gravity="center"
android:id="@+id/myPic"
/>
Run Code Online (Sandbox Code Playgroud)
我面临的问题是我的照片不是全屏......它是完整的screnn而不是整齐的.你可以在这里看到:
如果你可以帮助我增加一点它的大小,我会真的很赞成它.谢谢
编辑:我只想增加我的图像的宽度.谢!
您可能需要裁剪图像。由于图像未达到全高,因此图像的宽度会按比例缩小,因此两侧会出现黑色条纹。
更具体地说,使用手机摄像头拍摄的图像可能是为了完全适合屏幕,即图像的宽高比=屏幕的宽高比。但是,在您的应用程序中,图像的高度受到顶部按钮的限制,因此为了保持图像的宽高比,图像的宽度会按比例缩小。
归档时间: |
|
查看次数: |
9247 次 |
最近记录: |