0
fragmentTransaction.add(R.id.flLoginMainLayout,
OpenFragmentName, AppConstants.tag_prev_list_fragment);
它給我錯誤以下錯誤
E/UncaughtException:java.lang.IllegalArgumentException異常:(:ID/flLoginMainLayout com.doctorstay),用於片段OpenFragmentName {4450afc0#1的id = 0x7f0f0113 AnotherFragment}
我還用Diff容器調用相同的代碼在AnotherFragment未發現ID 0x7f0f0113視圖ID
((AnotherFragment) fragment).addFragment(R.id.flMainLayout,
OpenFragmentName, AppConstants.tag_prev_list_fragment);
XML佈局:activity_login_fragment(用途是flLoginMainLayout)
<?xml version="1.0" encoding="utf-8"?>
<FrameLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
android:id="@+id/flLoginMainLayout"
android:layout_width="match_parent"
android:layout_height="match_parent"
tools:context="com.pakagename.pakagename2.OpenFragmentName">
</FrameLayout>
XML對於登錄佈局:activity_login(用途是flLoginMainLayout)
<?xml version="1.0" encoding="utf-8"?>
<FrameLayout
xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools"
android:id="@+id/flRootLogin"
android:layout_width="match_parent"
android:layout_height="match_parent"
tools:context="com.pakagename.LoginActivity">
請發佈您的佈局代碼 –