0
 for (int i = 0; i <10; i++) {
            int count = i;
            iv_album[i] = new ImageView(this);
            iv_album[i].setImageDrawable(this.getResources().getDrawable(R.drawable.desimg));
            iv_album[i].setPadding(0, 5, 5, 0);
            iv_album[i].setId(i); // BELOW id 0 doesn't work
            iv_album[i].setScaleType(ImageView.ScaleType.FIT_XY);

            params1 = new RelativeLayout.LayoutParams(
                    RelativeLayout.LayoutParams.MATCH_PARENT, 230);
            if((i>0))
            {
            params1 = new RelativeLayout.LayoutParams(
                    150, 200);
            if (imgtype[i].equalsIgnoreCase("medium") )
            {
                //iv_album[i]
               // Picasso.with(getApplicationContext()).load("http://aflaree.com/yoday/Images/b.jpg").into(iv_album[i]);
                params1 = new RelativeLayout.LayoutParams(
                        150, 200);
                //params1.addRule(RelativeLayout.BELOW, iv_album[i - 1].getId());
                params1.addRule(RelativeLayout.ALIGN_PARENT_RIGHT, RelativeLayout.TRUE);
                params1.addRule(RelativeLayout.BELOW, iv_album[i - 1].getId());
                mainlayout.addView(iv_album[i], params1);

                //mainlayout.addView(iv_album[i], params1);
                Log.d("count:", "" + count);
            } else if (imgtype[i].equalsIgnoreCase("large"))
            {
                params1 = new RelativeLayout.LayoutParams(
                        250, 200);
                //params1.addRule(RelativeLayout.BELOW, iv_album[i - 1].getId());
                params1.addRule(RelativeLayout.RIGHT_OF,iv_album[i - 1].getId());
                //Picasso.with(getApplicationContext()).load("http://www.aflaree.com/yoday/Images/113/mm.jpg").into(iv_album[i]);
                //mainlayout.addView(iv_album[i], params2);
                mainlayout.addView(iv_album[i], params1);
                Log.d("count:", "" + count);
            } else if (i % 5 == 0)
        {
                Log.d("count:", "" + count);
                params1 = new RelativeLayout.LayoutParams(
                        RelativeLayout.LayoutParams.MATCH_PARENT, 200);
               // Picasso.with(getApplicationContext()).load("http://www.aflaree.com/yoday/Images/117/res30.png").into(iv_album[i]);

                //params3.addRule(RelativeLayout.ALIGN_PARENT_START, RelativeLayout.TRUE);
                params1.addRule(RelativeLayout.ALIGN_START);

                params1.addRule(RelativeLayout.BELOW, iv_album[i - 1].getId());
            mainlayout.addView(iv_album[i], params1);
                //mainlayout.addView(iv_album[i], params3);
            }
            else
            {
               // Picasso.with(getApplicationContext()).load("http://www.aflaree.com/yoday/Images/113/mm.jpg").into(iv_album[i]);
                params1.addRule(RelativeLayout.BELOW, iv_album[i - 1].getId());
                mainlayout.addView(iv_album[i], params1);
            }
        }
        else {
            //Picasso.with(getApplicationContext()).load("http://www.aflaree.com/yoday/Images/113/ca.jpg").into(iv_album[i]);
            params1.addRule(RelativeLayout.ALIGN_PARENT_LEFT, RelativeLayout.TRUE);
            params1.addRule(RelativeLayout.ALIGN_START,RelativeLayout.TRUE);
            mainlayout.addView(iv_album[i], params1);
        }

`i have three types of array of images like small, medium and large. if the first image type is small from array means i have to show the image in the left of the screen and then the next image type if it is medium means it will be come to right of to the small image and then next image if it is large means it will be below to both small and medium images. and the way 2 is if the first image type is large means it have to fill the screen in width filly not in height. height must be constant like 200. like wise each row having different row and columns. i'm trying to do like windows start screen. how to solve this issue? thanks in advance.

Harshad
  • 1,344
  • 1
  • 10
  • 25

0 Answers0