Error inflating class - NestedScrollView - class not found

痞子三分冷 提交于 2019-11-28 12:07:31

The full class name is android.support.v4.widget.NestedScrollView. Replace the <NestedScrollView> element with <android.support.v4.widget.NestedScrollView> and it should work fine. Make sure you have the v4 support library in your build.gradle file, too.

You need to add this line in dependencies:

compile 'com.android.support:support-v4:23.4.0'

Also as chessdork said it's android.support.v4.widget.NestedScrollView not NestedScrollView

If using androidx, replace <NestedScrollView> or full class name <android.support.v4.widget.NestedScrollView>with
<androidx.core.widget.NestedScrollView>

eng mohamed emam

Change it to

    <androidx.core.widget.NestedScrollView
        android:layout_width="match_parent"
        android:layout_height="wrap_content">

NestedScrollView was added in version 22.1.0
You should use NestedScrollView in the next way:

<?xml version="1.0" encoding="utf-8"?>
<android.support.v4.widget.NestedScrollView xmlns:android="http://schemas.android.com/apk/res/android"
    android:layout_width="match_parent"
    android:layout_height="match_parent">

</android.support.v4.widget.NestedScrollView>

build.gradle(module)

dependencies {
    implementation 'com.android.support:appcompat-v7:<greater than or equal to 22.1.0>'
    //...
}
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!