Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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

After update to v23.2.0 recyclerview items have strange behavior: very big with empty space. After update to design library 23.2.0 menu overflow icon became black (app has dark action bar).

UPDATE On my nexus 5 overflow icon & recycler view row are fixed, but on Galaxy Tab 4 overflow icon is still black.

UPDATE 2 If you have problems with empty spacing, fix layout parameters for your views (match_parent -> wrap_content), cause RecyclerView will now size itself based on the size of its contents. Read this blog 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.

UPDATE 3 Link to the issue that describes the problem with black icons in Action Bar Issue 201918

UPDATE 4 See my answer under post, icons problem is also solved

like image 310
android_dev Avatar asked Feb 25 '16 07:02

android_dev


2 Answers

The reason you are getting large open spaces is because of match_parent. It wasn't working correctly before, but now with the new release it is working differently. You just need to update to wrap_content instead of match_parent as that causes the layout to match the parent giving you the large spaces.

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

like image 58
James Britton Avatar answered Sep 23 '22 05:09

James Britton


It seems that two new libraries, support-vector-drawable and support-animated-vector-drawable, are required, because appcompat-v7 uses vector drawables (Issue discussion). Just update your build.gradle with the following for adding in support for vector drawables and the problem with black icons will be solved.

build.gradle

Add following lines to your build gradle base on your gradle plugin version

// Gradle Plugin 2.0+

 android {      defaultConfig {        vectorDrawables.useSupportLibrary = true       }    }    

// Gradle Plugin 1.5

 android {      defaultConfig {        generatedDensities = []     }      // This is handled for you by the 2.0+ Gradle Plugin     aaptOptions {       additionalParameters "--no-version-vectors"     }    }  

UPDATE For AppCompat users, the flags for enabling support vector drawables described in the 23.2 blog post are no longer required for usage of AppCompat 23.2.1. However, you can still take advantage of the app:srcCompat attribute if you wish to use support vector drawables for your own resources.

like image 39
android_dev Avatar answered Sep 23 '22 05:09

android_dev