Hi Developers,

I am trying to add dynamically 4 images on relative layout one after
another in a row. my code is below my problem is first image comes on
correct place but after that other 3 images come in a row but they start
from left side . means i dont know how other three images are left align
where as first image draw on correct place.

ArrayList<Object> sliderImageViewArray = new ArrayList<Object>() ;
        for (int i=0; i<4;i++) {
             ImageView iv = new ImageView(DetailProductActivity.this);
             iv.setImageResource(R.drawable.enable_slider);
             sliderImageViewArray.add(iv) ;
             RelativeLayout.LayoutParams lp = new
RelativeLayout.LayoutParams(
                        RelativeLayout.LayoutParams.WRAP_CONTENT,
                        RelativeLayout.LayoutParams.WRAP_CONTENT);

lp.addRule(RelativeLayout.BELOW,R.id.id_rl_view_pager_container) ;
            lp.setMargins(0, 18, 0, 0);
            iv.setId(i) ;
            if (i==0) {

lp.addRule(RelativeLayout.ALIGN_LEFT,R.id.id_tv_available_color) ;
            } else {
                ImageView tempImageView = (ImageView)
sliderImageViewArray.get(i-1) ;
                lp.addRule(RelativeLayout.RIGHT_OF,tempImageView.getId()) ;
           }
          rl_main_layout.addView(iv, lp);
        }

thanks

-- 
You received this message because you are subscribed to the Google
Groups "Android Developers" group.
To post to this group, send email to android-developers@googlegroups.com
To unsubscribe from this group, send email to
android-developers+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en
--- 
You received this message because you are subscribed to the Google Groups 
"Android Developers" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to android-developers+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.

Reply via email to