我应该在依赖项中添加 recyclerView 和 CardView 吗?
Should I add recyclerView and CardView in dependencies?
我在我的应用程序中使用 RecylerView
和 CardView
,这是我在 build.gradle
文件中的依赖项:
dependencies {
compile fileTree(dir: 'libs', include: ['*.jar'])
androidTestCompile 'junit:junit:4.12'
compile 'com.android.support:appcompat-v7:23.2.1'
compile 'com.android.support:design:23.2.1'
compile 'co.ronash.pushe:android-lib:0.9.1'
compile('com.mikepenz:materialdrawer:5.1.2@aar') {
transitive = true
}
compile('com.mikepenz:crossfadedrawerlayout:0.3.2@aar')
compile 'com.mikepenz:google-material-typeface:2.2.0.1@aar'
compile 'com.mikepenz:fontawesome-typeface:4.4.0.1@aar'
compile 'com.mikepenz:octicons-typeface:3.0.0.1@aar'
compile 'com.readystatesoftware.sqliteasset:sqliteassethelper:+'
compile 'com.github.bluejamesbond:textjustify-android:2.1.1'
compile 'com.squareup.picasso:picasso:2.5.2'
compile 'com.github.jd-alexander:LikeButton:0.2.0'
compile project(':material_rey')
}
我的应用程序在 kitkat 中正常运行。我是否应该将这些依赖项添加到我的 build.gradle 中?有什么区别?
compile 'com.android.support:cardview-v7:23.2.1'
compile 'com.android.support:recyclerview-v7:23.2.1'
我使用 Android Studio 2.0。当我 运行 我的应用程序在带有 android 5.1.1 (lollipop) 的三星 A5 上时,我的 RecyclerView
不滚动并且我的 CardView
没有阴影和角落。我尝试了 SO 中建议的解决方案,例如添加 card_view:cardUseCompatPadding="true"
或添加边距。即使将 xmlns:card_view="http://schemas.android.com/apk/res-auto"
更改为 xmlns:card_view="http://schemas.android.com/tools"
也不起作用。
这些问题与依赖关系有关吗?
com.android.support:design:23.2.1 包含了 RecyclerView。虽然 link 中没有提到 cardView,但如果您没有发现任何错误,并且 cardview 正在渲染,那么它也包含在内。因此,您不需要将这些添加到依赖项中。
如果 Recyclerview 的行适合屏幕,则不会滚动。您可以针对这些提出单独的 SO 问题。
我在我的应用程序中使用 RecylerView
和 CardView
,这是我在 build.gradle
文件中的依赖项:
dependencies {
compile fileTree(dir: 'libs', include: ['*.jar'])
androidTestCompile 'junit:junit:4.12'
compile 'com.android.support:appcompat-v7:23.2.1'
compile 'com.android.support:design:23.2.1'
compile 'co.ronash.pushe:android-lib:0.9.1'
compile('com.mikepenz:materialdrawer:5.1.2@aar') {
transitive = true
}
compile('com.mikepenz:crossfadedrawerlayout:0.3.2@aar')
compile 'com.mikepenz:google-material-typeface:2.2.0.1@aar'
compile 'com.mikepenz:fontawesome-typeface:4.4.0.1@aar'
compile 'com.mikepenz:octicons-typeface:3.0.0.1@aar'
compile 'com.readystatesoftware.sqliteasset:sqliteassethelper:+'
compile 'com.github.bluejamesbond:textjustify-android:2.1.1'
compile 'com.squareup.picasso:picasso:2.5.2'
compile 'com.github.jd-alexander:LikeButton:0.2.0'
compile project(':material_rey')
}
我的应用程序在 kitkat 中正常运行。我是否应该将这些依赖项添加到我的 build.gradle 中?有什么区别?
compile 'com.android.support:cardview-v7:23.2.1'
compile 'com.android.support:recyclerview-v7:23.2.1'
我使用 Android Studio 2.0。当我 运行 我的应用程序在带有 android 5.1.1 (lollipop) 的三星 A5 上时,我的 RecyclerView
不滚动并且我的 CardView
没有阴影和角落。我尝试了 SO 中建议的解决方案,例如添加 card_view:cardUseCompatPadding="true"
或添加边距。即使将 xmlns:card_view="http://schemas.android.com/apk/res-auto"
更改为 xmlns:card_view="http://schemas.android.com/tools"
也不起作用。
这些问题与依赖关系有关吗?
com.android.support:design:23.2.1 包含了 RecyclerView。虽然 link 中没有提到 cardView,但如果您没有发现任何错误,并且 cardview 正在渲染,那么它也包含在内。因此,您不需要将这些添加到依赖项中。
如果 Recyclerview 的行适合屏幕,则不会滚动。您可以针对这些提出单独的 SO 问题。