I have two imageView in a relative layout. Is it possible to dynamically change the position of an imageview. while the other remains constant.


I have Two Image Views Defined in Xml. I want to Change the Position of One of them Dynamically while the Other remains constant.?? Any Suggestions. Thanx.

Yes off course, this is damn possible.Use LayouParam

        ImageView img1=(ImageView) findViewById(R.id.imageview);
    ImageView img2=(ImageView) findViewById(R.id.imageview);

    RelativeLayout.LayoutParams lp2=new RelativeLayout.LayoutParams(100, 100);

Setting Margin

lp2.setMargins(Left, TOp, right,Bottom);