删除图像UIL之间的间距

编程入门 行业动态 更新时间:2024-10-24 13:29:56
本文介绍了删除图像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之间的间距

本文发布于:2023-11-12 01:06:18,感谢您对本站的认可!
本文链接:https://www.elefans.com/category/jswz/34/1580070.html
版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系,我们将在24小时内删除。
本文标签:间距   图像   UIL

发布评论

评论列表 (有 0 条评论)
草根站长

>www.elefans.com

编程频道|电子爱好者 - 技术资讯及电子产品介绍!