[Solved] Android Warning: Avoid passing null as the view root

When making an application, the Android SDK is changed from 4.4 to 6.0. When using the inflate method of layoutinflater, the following situation appears


When the parameter root is null, a warning message appears

Avoid passing null as the view root (needed to resolve layout parameters on the inflated layout’s root element)

You should add:


If you use the inflate method of view and root is null, the warning prompt will not appear



Similar Posts: