Greedo Layout for Android

A drop-in custom layout manager for Android RecyclerViews to layout a grid of photos while respecting their aspect ratios.



Download the latest release via Gradle:

repositories {
    maven { url '' }

dependencies {
    compile 'com.fivehundredpx:greedo-layout:1.5.1'


See the sample project for a complete solution on how to use GreedoLayout. Below are the specific steps.

// Create an instance of the GreedoLayoutManager and pass it to the RecyclerView
MyRecyclerAdapter recyclerAdapter = new MyRecyclerAdapter(this);
GreedoLayoutManager layoutManager = new GreedoLayoutManager(recyclerAdapter);

RecyclerView recyclerView = (RecyclerView)findViewById(;

// Set the max row height in pixels

// If you would like to add spacing between items (Note, MeasUtils is in the sample project)
int spacing = MeasUtils.dpToPx(4, this);
recyclerView.addItemDecoration(new GreedoSpacingItemDecoration(spacing));

And then, in your RecyclerView adapter, or some other class of your choosing, implement SizeCalculatorDelegate. This implementation got passed to the layout manager above.

public class MyRecyclerAdapter extends RecyclerView.Adapter<ViewHolder> implements SizeCalculatorDelegate {
    public double aspectRatioForIndex(int index) {
        // Return the aspect ratio of your image at the given index


GreedoLayout is released under the MIT license. See LICENSE for details.

Greedo Layout For Android

Full aspect ratio grid LayoutManager for Android's RecyclerView

Greedo Layout For Android Info

⭐ Stars 1588
🔗 Source Code
🕒 Last Update 4 months ago
🕒 Created 6 years ago
🐞 Open Issues 20
➗ Star-Issue Ratio 79
😎 Author 500px