
Untitled
By: a guest on
May 7th, 2012 | syntax:
None | size: 0.63 KB | hits: 22 | expires: Never
I have a two imageView in a Relative Layout. Is it possible to change the Position of one imageview dynamically. while the other remain constant.?
ImageView img1=(ImageView) findViewById(R.id.imageview);
ImageView img2=(ImageView) findViewById(R.id.imageview);
RelativeLayout.LayoutParams lp2=new RelativeLayout.LayoutParams(100, 100);
lp2.addRule(RelativeLayout.ALIGN_RIGHT,img2.getId());
img1.setLayoutParams(lp2);
lp2.setMargins(Left, TOp, right,Bottom);
RelativeLayout.LayoutParams params = imageView2.getLayoutParams();
params.addRule(RelativeLayout.CENTER_IN_PARENT);
imageView2.setLayoutParams(params);