Android L Recyclerview 低版本支援

2014 Google IO 釋出了三個新元件,

直接引入的話會有一點問題,

附上可以順利編譯的設定,

AndroidManifest.xml
1
2
3
4
5
6
7
8
9
10
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
package="com.semoncat.yourpackage">


<uses-sdk
tools:node="replace" />


...

</manifest>
build.gradle
1
android {
    compileSdkVersion 20
    buildToolsVersion '20.0.0'

    defaultConfig {
        minSdkVersion 15
        targetSdkVersion 20
        versionCode 1
        versionName "1.0"
    }
}

dependencies {
    compile 'com.android.support:recyclerview-v7:+'
    compile 'com.android.support:cardview-v7:+'
    compile 'com.android.support:palette-v7:+'
}