我试图在relativelayout的中心显示新视图。 但新视图始终位于屏幕顶部。
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);