简体   繁体   English

在轮播视图中增加图像大小的负载

[英]increase images sizes loads in carousel view android

I created app to display images from internet in carousel view. 我创建了一个应用,以在轮播视图中显示来自互联网的图像。 I loaded images into carousel view using imageview. 我使用imageview将图像加载到轮播视图中。 just like following way. 就像下面的方法一样。

public View getView(int position, View convertView, ViewGroup parent) {
        View vi=convertView;
        if(convertView==null)
            vi = inflater.inflate(R.layout.showsmain, null);

        ImageView image=(ImageView)vi.findViewById(R.id.imageView1);
       // RelativeLayout rlayout=(RelativeLayout)vi.findViewById(R.id.rlayouts);
       image.setImageResource(R.drawable.black);
        orgWidth = image.getDrawable().getIntrinsicWidth();
        orgHeight = image.getDrawable().getIntrinsicHeight();
        imageLoader.DisplayImage(data[position], image);
        imageLoader.getDimension(widthScreen, heightScreen);
        RelativeLayout.LayoutParams params = new RelativeLayout.LayoutParams(
                widthScreen, heightScreen/3);
        params.width=widthScreen;
            image.setLayoutParams(params);
            image.setScaleType(ImageView.ScaleType.FIT_XY);
            //rlayout.addView(image);
        return vi;
    }

and my carousel layout xml file is, 我的轮播布局xml文件是,

<com.touchmenotapps.carousel.simple.HorizontalCarouselLayout
        android:id="@+id/carousel_layout_event"
        android:layout_width="600dp"
        android:layout_height="500dp"
        android:layout_above="@+id/relativeLayout1"
        android:layout_alignTop="@+id/carousel_layout" >

    </com.touchmenotapps.carousel.simple.HorizontalCarouselLayout>

then image show as following way in carousel, 然后在轮播中以如下方式显示图片,

![enter image description here][1] ![在此处输入图片描述] [1]

Here i want to increase the image width & height. 在这里我想增加图像的宽度和高度。 It means one images must load fill with in the screen 这意味着一张图像必须在屏幕上加载

 public View getView(int position, View convertView, ViewGroup parent) {
        View vi=convertView;
        if(convertView==null)
            vi = inflater.inflate(R.layout.showimage, null);
        ImageView image=(ImageView)vi.findViewById(R.id.imageView1);
        //LinearLayout rlayout=(LinearLayout)vi.findViewById(R.id.layout);
       image.setImageResource(R.drawable.black);
        orgWidth = image.getDrawable().getIntrinsicWidth();
        orgHeight = image.getDrawable().getIntrinsicHeight();
        imageLoader.DisplayImage(data[position], image);
        imageLoader.getDimension(widthScreen, heightScreen);
        RelativeLayout.LayoutParams params = new RelativeLayout.LayoutParams(
                widthScreen,heightScreen/3);
        params.width=widthScreen/2;
            image.setLayoutParams(params);
            image.setScaleType(ImageView.ScaleType.FIT_XY);
            //rlayout.addView(image);
        return vi;
    }

this way I add the imageview into carousel view. 这样,我将imageview添加到轮播视图中。

how to do that. 怎么做。 I asked question similer this one. 我问了一个类似这个问题。 But i didn't get answer. 但是我没有得到答案。 pls help me someone. 请帮助我。 pls..... 请.....

my imageview xml layout file.. 我的imageview xml布局文件。

<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
    android:layout_width="fill_parent"
    android:layout_height="fill_parent" 
    android:id="@+id/rlayouts">

    <ImageView
        android:id="@+id/imageView1"
        android:layout_width="fill_parent"
        android:layout_height="fill_parent"
        android:layout_alignParentBottom="true"
        android:layout_alignParentLeft="true"
        android:layout_alignParentRight="true"
        android:scaleType="fitXY"
        android:layout_alignParentTop="true" />

</RelativeLayout>

I think you should use a Horizontal oriented Linear layout inside a Horizontal ScrollView then you should add ImageViews with FillParent Height and Width in this Linear layout. 我认为您应该在水平ScrollView中使用面向水平的线性布局,然后在此线性布局中添加具有FillParent Height和Width的ImageView。

It would be great if you elaborate your question a bit more. 如果再详细说明您的问题,那就太好了。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM