How to put a CardView attribute in a style?

后端 未结 4 1096
逝去的感伤
逝去的感伤 2020-12-15 02:17

I have:

in a file build.gradle (dependencies)

dependencies {
    compile \'com.android.support:cardview-v7:21.0.+\'
}

4条回答
  •  -上瘾入骨i
    2020-12-15 02:58

    This error can occur if you do not have CardView in your gradle dependencies (in Android Studio) for the module containing your style (even though you have the dependency in the module where you use the card view). In that case, simply add

    compile 'com.android.support:cardview-v7:22.2.1'
    

    (or another version) to build.gradle for the module containing themes.xml or styles.xml.

    Then, you do not need to set a parent on your style, nor do you need a namespace prefix, but can follow the example in tsik's answer, so all you need is

    
    

提交回复
热议问题