Android SnackBar: error inflating SnackbarLayout

拈花ヽ惹草 提交于 2019-11-29 05:35:05

Two thoughts on what could be wrong.

First, make sure you are using the correct gradle dependency:

compile 'com.android.support:design:22.2.0'

Second, make sure your activity is extending AppCompatActivity and not Activity or ActionBarActivity.

You can read the full post for more details, but here's the relevant quote about needing AppCompat with the new Support Design library:

Note that as the Design library depends on the Support v4 and AppCompat Support Libraries, those will be included automatically when you add the Design library dependency.

If you want to know why, you can read this or this for more background about Android's new "preferred" way of handling callbacks, specifically using AppCompatDelegate.

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!