Don't like ads? PRO users don't see any ads ;-)
Guest

Untitled

By: a guest on May 7th, 2012  |  syntax: None  |  size: 0.63 KB  |  hits: 22  |  expires: Never
download  |  raw  |  embed  |  report abuse  |  print
Text below is selected. Please press Ctrl+C to copy to your clipboard. (⌘+C on Mac)
  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);