简体   繁体   English

如何在意图打开的相机中添加图库按钮?

[英]How to add gallery button to Camera open with intent?

In my app users are able to make a photo with camera. 在我的应用程序中,用户可以使用相机制作照片。 And I start it using intents: 我使用意图启动它:

Intent(android.provider.MediaStore.ACTION_IMAGE_CAPTURE);

Now when open camera lacks the gallery button which would allow user to pick one of existing images from his SD card. 现在,当打开的相机缺少图库按钮时,该按钮将允许用户从其SD卡中选择现有图像之一。 Is it possible to show this button? 是否可以显示此按钮?

If you really want to have a button that links to the gallery while the user is in the Camera view, then you probably will need to create a custom camera activity. 如果您确实希望在用户处于“摄影机”视图中时有一个链接到图库的按钮,那么您可能需要创建一个自定义摄影机活动。 Android docs has a good explanation of how to get started: http://developer.android.com/training/camera/cameradirect.html Android文档很好地说明了如何入门: http : //developer.android.com/training/camera/cameradirect.html

You can't really change the things camera intent has to offer, and if you do find a device where the camera app would let you access the gallery I wouldn't depend on it. 您无法真正更改相机意图提供的功能,如果您确实找到了可以让相机应用程序访问图库的设备,则我不会依赖它。

I would recommend that whenever your user taps on the button or whatever launches the Camera Intent, launch a dialog that asks you the user to choose, "New Photo" or "Existing Photo". 我建议,只要您的用户点击按钮或以任何方式启动“相机意图”,就启动一个对话框,要求您选择“新照片”或“现有照片”。 If they choose existing, launch the gallery intent. 如果他们选择现有的,请启动图库意图。

Here is a really good tutorial for the gallery intent. 这是一个关于画廊意图的非常好的教程。

http://www.helloandroid.com/tutorials/gallery-intent-tutorial http://www.helloandroid.com/tutorials/gallery-intent-tutorial

Good Luck! 祝好运!

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM