比如像动态设置id为view的控件位置首先:
RelativeLayout.LayoutParams params = new RelativeLayout.LayoutParams(ViewGroup.LayoutParams.MATCH_PARENT,1);
实例化控件后,params.addRule(RelativeLayout.ALIGN_PARENT_BOTTOM);可设置该view的显示位置(我设置的是在最下方显示,替代item的分割线)
最后为该view设置params:view.setLayoutParams(params);