如何实现自定义设备照片廊为Android?自定义、如何实现、照片、设备

由网友(何必太在呼你)分享简介:我工作的Andr​​oid应用程序,将有包括基本的图片库功能。我已经成功地打造的活动,获取照片列表,我的应用程序的后台API和活动范围内的布局使其在Android的GridView控件。 I'm working on android application that will have basic image ga...

我工作的Andr​​oid应用程序,将有包括基本的图片库功能。我已经成功地打造的活动,获取照片列表,我的应用程序的后台API和活动范围内的布局使其在Android的GridView控件。

I'm working on android application that will have basic image gallery functionality included. I've managed to build activity that fetches list of photos from my application backend API and render them in android gridview within activity layout.

这是怎么看起来像此刻:

This is how it looks like at the moment:

不过我有困难,建立相同的画廊经验采取了相机和存储设备用户的设备中的照片。两种解决方案我认为是:

However I'm having difficulties to build same gallery experience for user's device photos that were taken by camera and stored on device. Two solutions I considered were:

在建设自己的图片库。 使用意图启动默认的Andr​​oid的图片库。

解决方案1:我相信是第一个解决方案都将带我太多的时间来开发。我开始与本教程但一旦我实现它,我发现它运行过慢。然后,我就来看看Android摄像头源$ C ​​$ C 找到解决办法,但我又发现,它会带我太多的时间来审查code和建立自己的画廊从零开始。我也相信,这不是在Android操作系统的理念,以重写已经存在,但使用意图,开始活动,可以处理你需要的操作功能。这导致我第二个解决方案。

Solution 1: I belive that first solution will take me too much time to developed. I started with this tutorial but as soon I implemented it I found out that it is running too slow. Then I take a look at android camera source code to find solution but again I found that it will take me too much time to review the code and to build my own gallery from scratch. I also believe that it is not in Android OS philosophy to rewrite functionalities that already exists but to use Intents to start activities that can handle actions you need. This lead me to second solution.

解决方案2:我打过电话,以便通过不久,我又坚持以浏览用户的设备中的照片使用意图默认的Andr​​oid库。问题这一次,一旦在照片的用户水龙头,画廊退出并返回到活动的渊源开始,而我期望(我想)开始大图preVIEW来代替。我看到别人有这个问题太如何通过意向无果打开图库。 因为我没有找到这个修复我决定辞职。

Solution 2: I tried calling default android gallery using intent in order to browse user's device photos by soon I was stuck again. Problem this time was that as soon as user tap on photo, gallery exits and returns to activity that originaly started it, and I expected (and I want) to start large image preview instead. I saw that others had this problem too how to open gallery via intent without result. Because I didn't find the fix for this I decided to quit.

我的问题是我怎么能解决这些问题,并建立画廊,类似于一个我已经有网页的照片。 如果任何人都可以给我参考一下我最感激的。

My question is how can I overcome these problems and build gallery that is similar to one I already have for web photos. If anyone could give me reference I would be most thankful.

推荐答案

这个问题是pretty的旧的,但,因为它有很多的观点和相当多的upvotes的,它可能是很好的把一个答案吧。

this question is pretty old but, as it has a lot of views and quite a lot of upvotes, it could be good to bring an answer to it.

因此​​,首先教程演变了一下,你可以找到一些很酷的东西为你的 1 选项:

So, first the tutorials evolved a bit and you can find some cool stuff for your #1 option:

这是一个我preFER 这一次采用了德precated UI元素,但也很酷 这使用适配器这是对我来说,最好的方式来进行。 This is the one I prefer This one uses a deprecated UI element but is also cool This uses an Adapter which is, to me, the best way to proceed.

有关您的 2 选项,我看不出有什么想法,不返回到原来的活动,因为你还没有控制权,通过系统发送的意图的结果。

For your #2 option, I do not see any idea to not to return to the original activity because you still do not have control over the result of the intent you send through the system.

但也有你没有提到另一种解决方案:有librairies这是非常酷,而且可以定制得到你想要的到底是什么:

But there are another solution that you didn't mention: there are librairies which are very cool and that you could customise to get exactly what you want:

这的一个是有点花哨 这的人似乎也为pretty的很酷,但你可以有问题的进口,因为它不是一个摇篮项目 这是一个我肯定会使用。 This one is a bit fancy This one seems also to be pretty cool but you could have problems importing it because it's not a gradle project This is the one I would definitely use.
阅读全文

相关推荐

最新文章