Error Inflating CollapsingToolbarLayout

前端 未结 5 495
清歌不尽
清歌不尽 2020-12-17 09:13

I recently updated the support design library to the latest version and now every activity that has a CollapsingToolbarLayout throws the following exception:

相关标签:
5条回答
  • 2020-12-17 09:49

    Try updating all of your support libraries to the 24.0.0-beta1 version. Then clean, rebuild and run your project again. That hopefully should fix your problem.

    0 讨论(0)
  • 2020-12-17 09:51

    Try updating a com.android.support:design dependency to the same version as other support libraries. I have just resolved this issue in my own project. I did not add it explicitly in my build.gradle since I use a library which uses support-design library. Gradle task androidDependencies showed that support design still had lower version after update of other libraries, so I added it explicitly and it worked like a charm.

    0 讨论(0)
  • 2020-12-17 10:00

    I answered a similar post here Error inflating class CollapsingToolbarLayout

    I know there is an accepted answer already, BUT it is not working (or no longer working).

    I spend a couple of hours researching on this error, what I came up is this.

    First, due to initial release of Android Nougat also known as Android 7.0 (API 24) compileSdkVersion 24 is now available. To do that you have to update your sdk. Step 1

    Second, is to update your gradle files (internet connection required). Step 2

    Also Update this part of app.gradle

    Third (optional) Clean Project, Build Project (Both under Build Tab)

    I hope this help someone out there and save some few hours of researching.

    Cheers / Happy coding

    Hope it helps.

    0 讨论(0)
  • 2020-12-17 10:01

    Found solution. Just add

    app:statusBarScrim="@null"
    

    to your CollapsingToolbarLayout

    0 讨论(0)
  • 2020-12-17 10:04

    Turns out I had another dependency that had a conflicting support library. When i removed the dependency, the project built and ran successfully.

    0 讨论(0)
提交回复
热议问题