我在应用程序中使用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'
我使用的是安卓Studio 2.0。当我在三星A5上用安卓5.1.1(棒棒糖)运行我的应用程序时,我的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。虽然链接中没有提到cardView,但如果你没有发现任何错误,并且cardView正在渲染,它也包含在内。因此,您不必将这些添加到依赖项中。
如果Recyclerview的行适合屏幕,它将不会滚动。您可以针对这些问题提出单独的SO问题。