删除图像UIL之间的间距 [英] Remove spacing between images UIL

查看:229
本文介绍了删除图像UIL之间的间距的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我试图夸大使用通用的图像加载程序和以下code在一个水平滚动视图几个imageviews

 的for(int i = 0; I< received_pa​​rams.length;我++){// received_pa​​rams ARRAY CONTAING网址
            最终ImageView的形象=新ImageView的(本);
            LinearLayout.LayoutParams PARAMS = NULL;
            PARAMS =新LinearLayout.LayoutParams(LayoutParams.WRAP_CONTENT,LayoutParams.MATCH_PARENT);
            image.setLayoutParams(PARAMS);            imageLoader.displayImage(received_pa​​rams [I],图像,选项);
            scrnshts_ll.addView(图片); // scrnshts_ll是线性布局image_view_ll对象
        }

和我的水平滚动的看法是

 < Horizo​​ntalScrollView
机器人:ID =@ + ID / image_view_hll
机器人:layout_width =FILL_PARENT
机器人:layout_height =250dp
机器人:背景=@彩色/ overlay_bg
机器人:填充=5DP><的LinearLayout
机器人:ID =@ + ID / image_view_ll
机器人:layout_width =WRAP_CONTENT
机器人:layout_height =match_parent
 机器人:方向=横向>
< / LinearLayout中>

现在我的问题,可以清楚地在附加的图片看到,其中有一个间隔的B / W每一个形象。 我想删除空白/黑白图像。如何做到这一点。


解决方案

  imageLoader.loadImage(received_pa​​rams [I],新ImageLoadingListener(){                @覆盖
                公共无效onLoadingStarted(字符串imageUri,查看视图){                }                @覆盖
                公共无效onLoadingFailed(字符串imageUri,观景,FailReason failReason){                }                @覆盖
                公共无效onLoadingComplete(字符串imageUri,观景,位图loadedImage){
                    INT宽度= loadedImage.getWidth();
                    ImageView的形象=新ImageView的(AppDetailsActivity.this);
                    LinearLayout.LayoutParams PARAMS =新LinearLayout.LayoutParams((INT)(宽度),LinearLayout.LayoutParams.MATCH_PARENT);
                    }                    params.setMargins(10,0,10,0);
                    image.setLayoutParams(PARAMS);
                    image.setScaleType(ScaleType.FIT_XY);
                    image.setImageBitmap(loadedImage);
                    scrnshts_ll.addView(图片);
                }                @覆盖
                公共无效onLoadingCancelled(字符串imageUri,查看视图){                }
            });

I'm trying to inflate several imageviews in a horizontal scroll view using Universal image loader and following code

for (int i = 0; i < received_params.length; i++) { //received_params ARRAY CONTAING URLs
            final ImageView image = new ImageView(this);
            LinearLayout.LayoutParams params = null;
            params = new LinearLayout.LayoutParams(LayoutParams.WRAP_CONTENT, LayoutParams.MATCH_PARENT);
            image.setLayoutParams(params);

            imageLoader.displayImage(received_params[i], image, options);   
            scrnshts_ll.addView(image); //scrnshts_ll is the object of Linear Layout image_view_ll
        }

and my horizontal scroll view is

 <HorizontalScrollView
android:id="@+id/image_view_hll"
android:layout_width="fill_parent"
android:layout_height="250dp"
android:background="@color/overlay_bg"
android:padding="5dp" >

<LinearLayout
android:id="@+id/image_view_ll"
android:layout_width="wrap_content"
android:layout_height="match_parent"
 android:orientation="horizontal" >
</LinearLayout>

now my problem can clearly be seen in attached image, in which there is a spacing b/w every image. I want to remove gaps b/w images. How to do it.

解决方案

imageLoader.loadImage(received_params[i], new ImageLoadingListener() {

                @Override
                public void onLoadingStarted(String imageUri, View view) {

                }

                @Override
                public void onLoadingFailed(String imageUri, View view, FailReason failReason) {

                }

                @Override
                public void onLoadingComplete(String imageUri, View view, Bitmap loadedImage) {
                    int width = loadedImage.getWidth();
                    ImageView image = new ImageView(AppDetailsActivity.this);
                    LinearLayout.LayoutParams params = new LinearLayout.LayoutParams( (int)(width), LinearLayout.LayoutParams.MATCH_PARENT);
                    }

                    params.setMargins(10, 0, 10, 0);
                    image.setLayoutParams(params);
                    image.setScaleType(ScaleType.FIT_XY);
                    image.setImageBitmap(loadedImage);
                    scrnshts_ll.addView(image);
                }

                @Override
                public void onLoadingCancelled(String imageUri, View view) {

                }
            });

这篇关于删除图像UIL之间的间距的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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