protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
RelativeLayout root = new RelativeLayout(this);
root.setLayoutParams(new LayoutParams(LayoutParams.MATCH_PARENT, LayoutParams.MATCH_PARENT));
ImageView iv = new ImageView(this);
iv.setImageResource(R.drawable.yourPic);
RelativeLayout.LayoutParams param = new RelativeLayout.LayoutParams(LayoutParams.WRAP_CONTENT, LayoutParams.WRAP_CONTENT);
param.addRule(RelativeLayout.ALIGN_PARENT_BOTTOM, RelativeLayout.TRUE);
param.addRule(RelativeLayout.ALIGN_PARENT_RIGHT, RelativeLayout.TRUE);
root.addView(iv, param);
setContentView(root);
}
AbsoluteLayout是android sdk1+时代的事了,现在都4+你还在问?开发中都不用了
官方都建议MVC模式,View通过XML来布局了