Android recyclerview v.23.2.0 和设计库 v.23.2.0 已损坏

Android recyclerview v.23.2.0 & design library v.23.2.0 are broken

更新到 v23.2.0 后,recyclerview 项目有奇怪的行为:很大但空的 space。更新设计库 23.2.0 后菜单溢出图标变黑(应用程序有深色操作栏)。

更新 在我的 Nexus 5 上,溢出图标和回收器视图行是固定的,但在 Galaxy Tab 4 上,溢出图标仍然是黑色的。

更新 2 如果您遇到空间距问题,请修复视图的布局参数(match_parent -> wrap_content),因为 RecyclerView 现在将根据其内容的大小自行调整大小。 阅读此博客 http://android-developers.blogspot.am/2016/02/android-support-library-232.html

The RecyclerView widget provides an advanced and flexible base for creating lists and grids as well as supporting animations. This release brings an exciting new feature to the LayoutManager API: auto-measurement! This allows a RecyclerView to size itself based on the size of its contents. This means that previously unavailable scenarios, such as using WRAP_CONTENT for a dimension of the RecyclerView, are now possible. You’ll find all built in LayoutManagers now support auto-measurement.

Due to this change, make sure to double check the layout parameters of your item views: previously ignored layout parameters (such as MATCH_PARENT in the scroll direction) will now be fully respected.

更新 3 Link 到描述操作栏中黑色图标问题的问题 Issue 201918

更新 4 看我在post下的回答,图标问题也解决了

您获得大片空地的原因是 match_parent。它以前不能正常工作,但现在有了新版本,它的工作方式就不同了。您只需要更新为 wrap_content 而不是 match_parent,因为这会导致布局与父级匹配,从而为您提供较大的空间。

The RecyclerView widget provides an advanced and flexible base for creating lists and grids as well as supporting animations. This release brings an exciting new feature to the LayoutManager API: auto-measurement! This allows a RecyclerView to size itself based on the size of its contents. This means that previously unavailable scenarios, such as using WRAP_CONTENT for a dimension of the RecyclerView, are now possible. You’ll find all built in LayoutManagers now support auto-measurement.

http://android-developers.blogspot.co.uk/2016/02/android-support-library-232.html

似乎需要两个新库,support-vector-drawable 和 support-animated-vector-drawable,因为 appcompat-v7 使用矢量 drawable(Issue discussion).只需使用以下内容更新您的 build.gradle 以添加对矢量绘图的支持,黑色图标的问题将得到解决

build.gradle

根据您的 gradle 插件版本

,将以下行添加到您的构建 gradle

// Gradle 插件 2.0+

 android {  
   defaultConfig {  
     vectorDrawables.useSupportLibrary = true  
    }  
 }   

// Gradle 插件 1.5

 android {  
   defaultConfig {  
     generatedDensities = []  
  }  

  // This is handled for you by the 2.0+ Gradle Plugin  
  aaptOptions {  
    additionalParameters "--no-version-vectors"  
  }  
 } 

更新 对于 AppCompat 用户,使用 AppCompat 23.2.1 不再需要 23.2 blog post 中描述的用于启用支持矢量绘图的标志。但是,如果您希望为自己的资源使用支持矢量可绘制对象,您仍然可以利用 app:srcCompat 属性。