Most of the ways that this error occurs online are
1. Check fragment package name, support.v4 is not the same as normal
Check your activity. If you are using a v4 fragment, you must inherit FragmentActivity (v4), or you can use CompatActivity(V7).
3. Static load fragment must give id
There may also be some other logic errors, such as whether the oncreateview fragment has loaded the correct layout, whether the parse is correct, whether the return is correct, etc.
If the above operation can not solve the error, then there is only one way, dynamic loading, it seems that the V4 package fragment does not support static loading, the specific reason has not been found, try dynamic loading can be used normally
V4 package dynamic loading: getSupportFragmentManager (). The beginTransaction (). The replace (layoutId, fragments, the tag). The commit ();
Non-v4 packages can load statically and dynamically.
1. Check fragment package name, support.v4 is not the same as normal
Check your activity. If you are using a v4 fragment, you must inherit FragmentActivity (v4), or you can use CompatActivity(V7).
3. Static load fragment must give id
There may also be some other logic errors, such as whether the oncreateview fragment has loaded the correct layout, whether the parse is correct, whether the return is correct, etc.
If the above operation can not solve the error, then there is only one way, dynamic loading, it seems that the V4 package fragment does not support static loading, the specific reason has not been found, try dynamic loading can be used normally
V4 package dynamic loading: getSupportFragmentManager (). The beginTransaction (). The replace (layoutId, fragments, the tag). The commit ();
Non-v4 packages can load statically and dynamically.
Read More:
- After Android studio creates a new bottomnavigationactivity, there is a blank solution in the upper area of fragment
- Deploy mongodb fragment combined with replica set to realize distributed storage of MySQL database files (step 10)
- There is more than one Web fragment with the same name: “spring_web”.
- [Android] button uses the custom drawable file to set the background, and runs “error inflating class button”
- Error inflating class TextView [How to Solve]
- Error inflating class android.support.v7.widget.SearchView
- android studio:Error inflating class android.support.v4.widget.SwipeRefreshLayout
- Android error reporting: error inflating class android.webkit.WebView
- Inheritance relationship causes class loading order
- [Android] ImageView setting background image error: error inflating class ImageView
- Python custom class typeerror: ‘module’ object is not callable
- Depending on the custom component jar package, unable to read meta data for class appears after startup
- Error inflating class in WebView in Android 5. X android.webkit.WebView Solutions
- Loading class `com.mysql.jdbc.Driver‘. This is deprecated. The new driver class is `com.mysql.cj.jdb
- Unknown custom element: <component> – did you register the component correctly
- Error c2011: “a certain class”: redefinition of “class” type
- An error occurred while loading commit signatures
- The shell runs the class file and imports the jar package that the class depends on
- Problems encountered after Maven installation or upgrade: could not find or load main class org.codehaus.plexus .class…..
- Load balancing failed to find a valid mailbox database