异常:java.lang.IllegalStateException: The specified child already has a parent. You must call removeView() on the child's parent first.
原因:View是不能同时有两个parent的。
builder.setView(linearLayout);
其中linearLayout不要在Activity的onCreate()中赋值。
改为在dialog中赋值就能解决此异常。
LinearLayout linearLayout = (LinearLayout)findViewById(R.id.help);
AlertDialog.Builder builder = new Builder(activity);
builder.setView(linearLayout);
builder.create().show();