I tried to show new view on the center of relativelayout. But the new view always places on the top of screen.
LayoutInflater inflater = (LayoutInflater)this.getSystemService("layout_inflater");
dest = inflater.inflate(R.layout.searchlayout, ViewGroup)
this.findViewById(开发者_如何学运维R.layout.pdfview));
RelativeLayout.LayoutParams params = new RelativeLayout.LayoutParams(RelativeLayout.LayoutParams.WRAP_CONTENT, RelativeLayout.LayoutParams.WRAP_CONTENT);
params.addRule(RelativeLayout.CENTER_VERTICAL);
dest.setLayoutParams(params);
this.addContentView(dest, params);
精彩评论