主要代码:
setContentView(R.layout.layout);LayoutParams params = getWindow().getAttributes();params.width = LayoutParams.MATCH_PARENT;getWindow().setAttributes(params);