我有一个scrollview,它有一个孩子的linearlayout。现在,当我启动我的应用程序时,我收到以下错误
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;