1
나는 FragmentTransition와 빈 FrameLayout이에 새로운 조각을 추가하기 위해 노력하고있어 나는 다음과 같은 예외가 계속 : 나는 FrameLayout이 자체를 추가하려고하는 것으로 나타났습니다 디버깅 할 때IllegalStateException이
java.lang.IllegalStateException: The specified child already has a parent. You must call removeView() on the child's parent first.
at android.view.ViewGroup.addViewInner(ViewGroup.java:2840)
at android.view.ViewGroup.addView(ViewGroup.java:2735)
at android.view.ViewGroup.addView(ViewGroup.java:2691)
at android.view.ViewGroup.addView(ViewGroup.java:2671)
at android.app.FragmentManagerImpl.moveToState(FragmentManager.java:739)
at android.app.FragmentManagerImpl.moveToState(FragmentManager.java:919)
at android.app.BackStackRecord.run(BackStackRecord.java:578)
at android.app.FragmentManagerImpl.execPendingActions(FragmentManager.java:1217)
at android.app.FragmentManagerImpl.executePendingTransactions(FragmentManager.java:384)
at android.someApp.OverviewListFragment.showDetailsForSelectedMessage(OverviewListFragment.java:67)
을 이 예외를 일으키는 것으로 보이는 자체 자식으로
private void showDetailsForSelectedMessage() {
ScenarioDetailsFragment fragment = ScenarioDetailsFragment.newInstance(selectedMessage);
getFragmentManager().beginTransaction()
.replace(R.id.scenario_details_container, fragment)
.disallowAddToBackStack() //Problem occurs with and without this line
.setTransition(FragmentTransaction.TRANSIT_FRAGMENT_FADE)
.commit();
getFragmentManager().executePendingTransactions();
}
:
여기
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout
xmlns:android="http://schemas.android.com/apk/res/android"
android:orientation="horizontal"
android:layout_width="match_parent"
android:layout_height="match_parent">
<fragment
android:name="android.someApp.OverviewListFragment"
android:id="@+id/overview_list_fragment"
android:layout_weight="0.3"
android:layout_width="0px"
android:layout_height="match_parent" />
<FrameLayout
android:id="@+id/scenario_details_container"
android:layout_width="wrap_content"
android:layout_height="match_parent"
android:background="?android:attr/detailsElementBackground"/>
</LinearLayout>
내가 전환을 수행하기 위해 노력하고있어 어디에 : 여기
내가에 조각을 추가하려고 해요 활동에 대한 layout.xml 파일입니다나는 너무 오래이 문제에 대한 내 머리를 때 렸습니다. 밖에서 아무도 여기에 무슨 일이 일어나는가?
비슷한 문제가 있습니다. 알아 냈어? 어떤 도움을 주시면 감사하겠습니다. –