Error inflating class and android.support.v7.widget.CardView

后端 未结 15 1596
-上瘾入骨i
-上瘾入骨i 2020-11-27 20:47

I want to use CardView in my project, but when I run my application, I get the following error. I\'m using Eclipse.

Error: Error inflating clas         


        
15条回答
  •  失恋的感觉
    2020-11-27 21:24

    I guess I can answer my own question.

    Go to File -> Import -> Existing Android code into workspace --> Browse (Go to sdk/extras/android/support/v7/cardview) --> Click ok --> Click Finish

    Your project explorer will now show cardview as a project.

    Right click on cardview project --> Properties --> Android(Left Pane) --> Enable isLibrary (tick the checkbox) --> Apply --> ok

    Now Right click on your project --> Properties --> Android(Left pane) --> Add (under library) --> cardview --> apply --> ok

    Now right click on your project again --> build path --> configure build path --> Under projects tab, add cardview

    You are done.

提交回复
热议问题