使用android相机拍照的问题
经过几天的努力,我终于成功在物理设备上拍摄了一张像样的照片。为此,我必须将我的活动设置为风景视图。 但我面临一些问题。 首先,我必须在图像上写下文字,其次,带有应用程序名称的栏出现在屏幕右侧,我想删除它。 其外观如下:http://i54.tinypic.com/14xi42e.png。
在物理设备上,图像看起来OK
,我不想改变它。我想要改变的是文字。我希望它设置在图像的底部水平对齐(而不是垂直对齐)现在怎么样)。 其次,我想去掉带有应用程序名称的栏,即右侧的栏。
这是一些代码,其中包含我在图像上写入文本的方式以及我如何为活动设置 LANDSCAPE 视图:
public void onCreate(Bundle icicle) {
super.onCreate(icicle);
this.setRequestedOrientation(ActivityInfo.SCREEN_ORIENTATION_LANDSCAPE);
.............
Canvas c = new Canvas(bitmapResult);
drawTextImage(bitmapResult);
ImageView imageView = (ImageView) findViewById(R.id.myPic);
imageView.setImageBitmap(bitmapResult);
}
private Canvas drawTextImage(Bitmap b) {
Canvas c = new Canvas(b);
Paint paint = new Paint();
paint.setColor(Color.BLUE);
paint.setStrokeWidth(30);
paint.setStyle(Paint.Style.FILL);
paint.setAntiAlias(true);
paint.setTextSize(8);
c.drawText("Xperia-Orange!", 1, 80, paint);
return c;
}
如果您需要额外的信息,我会在这里为您提供。谢谢!
After days of struglling I have finally succeded to take a decent picture on a physical device.For this I had to set my activity to have a landscape view.
But I'm facing a few problems.
First I have to write a text on the image and second the bar with the name of the application appears on the right of the screen and I wanna get rid of it.
Here is how it looks: http://i54.tinypic.com/14xi42e.png.
On the physical device the image is looking OK
and I don't wanna change that.What I wanna change is the writting.I want it to be set at the bottom of the image horizontally aligned(not vertical how is now).
And second I wanna get rid of the bar with the name of the application, the one in the right.
This is a bit of code with the way I'm writting text on the image and how I'm setting up the LANDSCAPE view for the activity:
public void onCreate(Bundle icicle) {
super.onCreate(icicle);
this.setRequestedOrientation(ActivityInfo.SCREEN_ORIENTATION_LANDSCAPE);
.............
Canvas c = new Canvas(bitmapResult);
drawTextImage(bitmapResult);
ImageView imageView = (ImageView) findViewById(R.id.myPic);
imageView.setImageBitmap(bitmapResult);
}
private Canvas drawTextImage(Bitmap b) {
Canvas c = new Canvas(b);
Paint paint = new Paint();
paint.setColor(Color.BLUE);
paint.setStrokeWidth(30);
paint.setStyle(Paint.Style.FILL);
paint.setAntiAlias(true);
paint.setTextSize(8);
c.drawText("Xperia-Orange!", 1, 80, paint);
return c;
}
If you need extra information I'm here to give it to you.Thanks!
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
试试这个
http://marakana.com/forums/android/examples/39.html< /一>
<一href="http://p2p.wrox.com/book-professional-android-application-development-isbn-978-0-470-34471-2/72528-article-using-android-camera.html" rel="nofollow">http://p2p.wrox.com/book-professional-android-application-development-isbn-978-0-470-34471-2/72528-article-using-android-camera.html< /a>
try this
http://marakana.com/forums/android/examples/39.html
http://p2p.wrox.com/book-professional-android-application-development-isbn-978-0-470-34471-2/72528-article-using-android-camera.html