本文介绍了删除图像UIL之间的间距的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我试图夸大使用通用的图像加载程序和以下code在一个水平滚动视图几个imageviews
的for(int i = 0; I< received_params.length;我++){// received_params ARRAY CONTAING网址 最终ImageView的形象=新ImageView的(本); LinearLayout.LayoutParams PARAMS = NULL; PARAMS =新LinearLayout.LayoutParams(LayoutParams.WRAP_CONTENT,LayoutParams.MATCH_PARENT); image.setLayoutParams(PARAMS); imageLoader.displayImage(received_params [I],图像,选项); scrnshts_ll.addView(图片); // scrnshts_ll是线性布局image_view_ll对象 }和我的水平滚动的看法是
< HorizontalScrollView机器人: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_params [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之间的间距
发布评论