All Projects → PierfrancescoSoffritti → ShrinkingImageLayout

PierfrancescoSoffritti / ShrinkingImageLayout

Licence: Apache-2.0, Apache-2.0 licenses found Licenses found Apache-2.0 LICENSE Apache-2.0 LICENSE.md
Android layout with an header image sensible to scroll and touch events.

Programming Languages

java
68154 projects - #9 most used programming language

ShrinkingImageLayout

Android layout with an header image sensible to scroll and touch events. Original code taken from Plaid and made into a backward compatible layout, sensible to RecyclerView scrolls.

Download the sample app here

Apps using this library: Shuffly

Download

Add this to you project-level build.gradle:

allprojects {
  repositories {
    ...
    maven { url "https://jitpack.io" }
  }
}

Add this to your module-level build.gradle:

dependencies {
  compile 'com.github.PierfrancescoSoffritti:ShrinkingImageLayout:0.4'
}

Usage

ShrinkingImageLayout is a simple FrameLayout with some extra functionalities.

Add the ViewGroup to your layout file:

<com.pierfrancescosoffritti.shrinkingimagelayout.ShrinkingImageLayout
    xmlns:android="http://schemas.android.com/apk/res/android"
    android:id="@+id/shrinking_image_layout"
    android:layout_width="match_parent"
    android:layout_height="match_parent" />

Then set it up by calling this method:

shrinkingImageLayout.setupRecyclerView(new RecyclerView(this), new LinearLayoutManager(this), new Adapter(getData()));

the adapter must implement HeaderRecyclerViewAdapter

Extra

To add an header to the RecyclerView call this method:

shrinkingImageLayout.addCustomHeader(header);

Where header can be any View object.


Call this method to get a reference to the ImageView

shrinkingImageLayout.getImageView();

On API 21+ the ImageView automatically handles its Z animation when scrolled and touched.

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].