在控件的四個角落添加子控件(左上角,右上角,左下角,右下角) spa
在RelativeLayout中有這麼幾種對齊方式 new
RelativeLayout.ALIGN_PARENT_BOTTOM 控件
RelativeLayout.ALIGN_PARENT_TOP
RelativeLayout.ALIGN_PARENT_LEFT
RelativeLayout.ALIGN_PARENT_RIGHT
So ,若是想在父控件的右下角添加控件
xxxViewGroup.addView(xxxView);
RelativeLayout.LayoutParams params = new RelativeLayout.LayoutParams();
params.addRule(RelativeLayout.ALIGN_PARENT_BOTTOM, RelativeLayout.TRUE);
params.addRule(RelativeLayout.ALIGN_PARENT_RIGHT, RelativeLayout.TRUE);
xxxView.setLayoutParams(params);