ImageDetailsActivity的回收视图 [英] ImageDetailsActivity for a recycler view

查看:178
本文介绍了ImageDetailsActivity的回收视图的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

在我的Andr​​oid应用程序,我列出与网络图像查看图像'previews。我想,如果用户preSS的previews它打开与viewpager的活动和展示我的回收鉴于特定项目的原始图像。所以,我有两个方法,在我的脑海。

in my android app, I am listing the images' previews with network image view. I want that if user press the previews it opens an activity with viewpager and show the original images of specific item of my recycler view. So, i have a two method in my mind.

1)我要拯救我的每个图像的两个图像在我的数据库。其中一人将与小尺寸和另一个preVIEW的图像将是原来的。在我的主要新闻推送,应用程序将加载preVIEW图像,以便下载大小将变小。如果用户$ P $的PSS的preVIEW图像它会打开活动并下载原之一。

1-) I will save two image for each of my images in my database. One of them will be preview image with small size and other one will be the original one. In my main newsfeed, app will load the preview images so download size will be smaller. And if user press a preview image it will open activity and download the original one.

2-)将有我的数据库只有原始图像,我会尽量减少它的大小在下载后,直接,因为它已经被下载,如果用户preSS的preVIEW将显示原始。

2-) There will be only original images in my db and i will minimize it's size after the download and if user press the preview it will show the original one directly since it is already downloaded.

我不知道哪一个是比较好的方法,还是有比那些更好的方法?

I wonder which one is better method, or is there a better method than those?

这是我为我的图像设置点击监听器:

This is where i set click listeners for my images:

for(int i = 0; i < listItem.getImageCount(); i++) {
        final NetworkImageView niv = new NetworkImageView(context);

        niv.setOnClickListener(new View.OnClickListener() {

            @Override
            public void onClick(View v) {
                // TODO Auto-generated method stub
            }
        });

        holderr.layoutImages.addView(niv);
    }

感谢您。

推荐答案

你可以试试这个

<一个href=\"http://stackoverflow.com/questions/18573774/how-to-reduce-an-image-file-size-before-uploading-to-a-server\">How上传到服务器之前减少图像文件大小

我们的想法是,发送到服务器之前,该图像的尺寸将减小,然后下载,之后(如 - 小的ImageView ),

The idea is, before sending to the server, that image's size would be decreased and then download it, after that(e.g - in small ImageView),

使用这样的事情:完全DOC:的http://开发商。 android.com/reference/android/widget/ImageView.ScaleType.html

Use something like this: Full doc: http://developer.android.com/reference/android/widget/ImageView.ScaleType.html

的android:scaleType =centerCrop

然后,如果用户点击了信息按钮(或其他),大的ImageView 将显示但是,与身高和体重之间的一个差
它比previous 的ImageView

And then if the users clicked on the info Button(or whatever), the big ImageView will be shown But, with one difference between the height and weight of it than previous ImageView.

下面是使用一个例子的ImageView 的android:scaleType =fitXY

Here is an example for using that ImageView with android:scaleType="fitXY" :

<ImageView
   android:layout_width="match_parent"
   android:layout_height="match_parent"
   android:contentDescription="Main Image"
   android:padding="1dp"
   android:scaleType="fitXY"
   android:src="@drawable/balloon" />

的http:// HMK code .COM / Android的设计 - 的WhatsApp样的用户配置文件屏幕/

问题的关键是,我觉得你并不需要的图像保存在你的SD卡或wherever.just使用(存放)一次最优质的:)

The point is, i think you don't need to store that image in your sdcard or wherever.just use it(store it) one time with the best quality :)

希望帮助。

这篇关于ImageDetailsActivity的回收视图的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆