Guest User

Untitled

a guest
May 7th, 2012
40
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.63 KB | None | 0 0
  1. 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.?
  2. ImageView img1=(ImageView) findViewById(R.id.imageview);
  3. ImageView img2=(ImageView) findViewById(R.id.imageview);
  4.  
  5. RelativeLayout.LayoutParams lp2=new RelativeLayout.LayoutParams(100, 100);
  6. lp2.addRule(RelativeLayout.ALIGN_RIGHT,img2.getId());
  7. img1.setLayoutParams(lp2);
  8.  
  9. lp2.setMargins(Left, TOp, right,Bottom);
  10.  
  11. RelativeLayout.LayoutParams params = imageView2.getLayoutParams();
  12. params.addRule(RelativeLayout.CENTER_IN_PARENT);
  13. imageView2.setLayoutParams(params);
Advertisement
Add Comment
Please, Sign In to add comment