我有一个滚动视图,它有一个线性布局作为孩子。现在当我启动我的应用程序时,我收到以下错误
03-11 10:58:35.723: E/AndroidRuntime(6261): java.lang.IllegalStateException: The specified child already has a parent. You must call removeView() on the child's parent first.
03-11 10:58:35.723: E/AndroidRuntime(6261): at android.view.ViewGroup.addViewInner(ViewGroup.java:3654)
03-11 10:58:35.723: E/AndroidRuntime(6261): at android.view.ViewGroup.addView(ViewGroup.java:3525)
03-11 10:58:35.723: E/AndroidRuntime(6261): at android.view.ViewGroup.addView(ViewGroup.java:3482)
03-11 10:58:35.723: E/AndroidRuntime(6261): at android.view.ViewGroup.addView(ViewGroup.java:3462)
03-11 10:58:35.723: E/AndroidRuntime(6261): at android.support.v4.app.NoSaveStateFrameLayout.wrap(NoSaveStateFrameLayout.java:40)
03-11 10:58:35.723: E/AndroidRuntime(6261): at android.support.v4.app.FragmentManagerImpl.moveToState(FragmentManager.java:915)
03-11 10:58:35.723: E/AndroidRuntime(6261): at android.support.v4.app.FragmentManagerImpl.moveToState(FragmentManager.java:1088)
03-11 10:58:35.723: E/AndroidRuntime(6261): at android.support.v4.app.BackStackRecord.run(BackStackRecord.java:682)
03-11 10:58:35.723: E/AndroidRuntime(6261): at android.support.v4.app.FragmentManagerImpl.execPendingActions(FragmentManager.java:1444)
03-11 10:58:35.723: E/AndroidRuntime(6261): at android.support.v4.app.FragmentManagerImpl.executePendingTransaction
下面是我的xml
<?xml version="1.0" encoding="utf-8"?>
<ScrollView xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="fill_parent"
android:layout_height="fill_parent" >
<LinearLayout
android:id="@+id/info_linearlayout"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:orientation="vertical" >
.......................
...................
</LinearLayout>
</ScrollView>
下面是我的 java 代码,我在其中获取滚动视图,然后获取相对布局
oScrollView = (ScrollView) LayoutInflater.from(getActivity()).inflate(R.layout.eyefeedinfo, null);
EyeFeedWizard.m_oInfoPage = (LinearLayout) oScrollView.findViewById(R.id.info_linearlayout);
/
oCurrentPage = EyeFeedWizard.m_oInfoPage;