FrameLayout container = new FrameLayout(parent.getContext());
container.setLayoutParams(
new ViewGroup.LayoutParams(ViewGroup.LayoutParams.MATCH_PARENT,
ViewGroup.LayoutParams.MATCH_PARENT));
//关键代码要出来这两个
container.setId(ViewCompat.generateViewId());
container.setSaveEnabled(false);