View childView = findViewById(R.id.child1); RelativeLayout parent = findViewById(R.id.parent); RelativeLayout.LayoutParams lps = (RelativeLayout.LayoutParams) childView.getLayoutParams(); lps.rightMargin = dip2px(this, 20.0f); lps.addRule(RelativeLayout.ALIGN_PARENT_RIGHT); View childView2 =...