Android library implementing a fading effect for the action bar, similar to the one found in the Play Music app

Overview

FadingActionBar

FadingActionBar is a library which implements the cool fading action bar effect that can be seen in the new Play Music app.

This library uses the techniques outlined by Cyril Mottier in a popular blog post.

The three most commonly used action bar implementations are supported: stock (API 11+), ActionBarCompat and ActionBarSherlock.

Example Image

Try out the sample application:

Android app on Google Play

Or browse the source code of the sample application for a complete example of use.

Including in your project

The library is pushed to Maven Central as a AAR, so you just need to add the following dependency to your build.gradle.

dependencies {
    compile 'com.github.manuelpeinado.fadingactionbar:fadingactionbar:3.1.2'
}

If your project doesn't use the stock action bar, but one of the compatibility implementations, you would use the following:

dependencies {
    // Use the following if your project uses ActionBarCompat
    compile 'com.github.manuelpeinado.fadingactionbar:fadingactionbar-abc:3.1.2'
    // Or the following if your project uses ActionBarSherlock
    compile 'com.github.manuelpeinado.fadingactionbar:fadingactionbar-abs:3.1.2'
}

Usage

Using the library is really simple, just look at the source code of the provided samples:

You can even use the library from a fragment, which is useful when implementing a dual phone/tablet layout.

See the demos included in the sample application for a complete overview of the features supported by the library.

Known Issues

There is an important issue with the library and ListViews. More specifically, things don't work quite right when the activity is re-created due to a configuration change. So, unless you handle configuration changes yourself (or your activity is portrait/landscape only), I strongly suggest you stick to having your content in a ScrollView until a solution to this issue is found.

Acknowledgements

  • Thanks to Cyril Mottier for sharing the techniques that make this library possible.
  • Thanks to Antonio Leiva for writing the Navigation Drawer sample.
  • Thanks to Michał Motyczko for coming up with a fix for an important bug.

Who's using it

  • #ДАНСwithme. This app attempts to organise information from various social network streams into a single source.
  • Pearl Jam Lyrics. Unofficial app for Pearl Jam fans that want to have all the lyrics of their favorite band in the palm of their hands.
  • Weatherize. A weather app that is designed to look great and tell you the weather like a human does, not a machine.
  • Last.fm for Android. Do you think the official Last.fm app feels a little bit outdated? Check out this one! It has a scrobbler, and a non-ugly holo interface.
  • Watch South Park Episodes. Watch full-length South Park episodes directly from your phone! Browse through your favorite season or search for your favorite episode!
  • Gas Monitor. An application designed around individuals who keep track of their fill history on their vehicles: from price, gallons, date purchased, and miles traveled.
  • RSS Reader. Get all your news in a simple and fluid application.
  • Night of the museums. A unique and easy way to be closer to the art and history of the region of Yekaterinburg, Nevyansk, Irbit and Nizhny Tagil (Russia).
  • Lffl Feed Reader. Lffl feed reader is a free app that allows you to stay up to date on the latest news of your favorite linux blogs using a modern and minimal interface.
  • Club Douala Ravensburg. This app gives you access to the program of the Club Douala Ravensburg (Germany).

Does your app use FadingActionBar? If you want to be featured on this list drop me a line.

Developed By

Manuel Peinado Gallego - [email protected]

Follow me on Twitter Follow me on Google+ Follow me on LinkedIn

License

Copyright 2013,2014 Manuel Peinado

Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at

   http://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
Comments
  • I keep getting the same error. Not sure what the issues is?

    I keep getting the same error. Not sure what the issues is?

    Caused by: java.lang.NullPointerException: Attempt to invoke virtual method 'void android.support.v7.app.ActionBar.setBackgroundDrawable(android.graphics.drawable.Drawable)' on a null object reference at com.manuelpeinado.fadingactionbar.extras.actionbarcompat.FadingActionBarHelper.setActionBarBackgroundDrawable(FadingActionBarHelper.java:59) at com.manuelpeinado.fadingactionbar.FadingActionBarHelperBase.initActionBar(FadingActionBarHelperBase.java:173) at com.manuelpeinado.fadingactionbar.extras.actionbarcompat.FadingActionBarHelper.initActionBar(FadingActionBarHelper.java:32) at com.purewow.myapplication.Recipe.onCreate(Recipe.java:20)

    Is this a common problem?

    Thanks in advance!

    opened by phillwiggins 12
  • notifyDataSetChanged() in List combined with FadingActionBar destroys view

    notifyDataSetChanged() in List combined with FadingActionBar destroys view

    I got a problem with a ListView in combination with the FadingActionBar. Once every minute I recalculate the displayed data and call notifyDataSetChanged on the associated adapter.

    But every time this happens, the header image gets visible and is visible THROUGH the scrolled list. Only if the list is at its top position, everything stays fine.

    screenshot_2013-06-24-22-33-13

    Do you have any idea why this happens? Thanks!

    opened by Zordid 11
  • Using only with resource ids.

    Using only with resource ids.

    Your lib is great but it can be initialized with only resource ids. And you are using setContentView of the activity. So this cannot be used with fragments. Maybe you should have another helper method in which ScrollView and HeaderView are the actual parameters not the ids.

    opened by tasomaniac 8
  • [SOLVED] Transparent actionbar is not working on fragment

    [SOLVED] Transparent actionbar is not working on fragment

    Hello everyone, i'm trying to use the fadingActionBar on my app and i used the code of the SampleFragment.java but i'm having a small issue. as you can see in the image the actionbar is not transparent. what i'm doing wrong? thank you screenshot_2014-02-25-12-03-41

    opened by giwrgos88 5
  • Fixes messed up header view after notifyDataSetChanged() from listadapter

    Fixes messed up header view after notifyDataSetChanged() from listadapter

    After notifyDataSetChanged() from LIstAdapter container view is triggered to relayout all children including header view. During relayout it does not keep offset but sets top position based on gravity to 0. After relayout Helper class is notified about new scroll and listview top visible position is not changed so we can just check for that. If header view top position is 0 but previous top position was <0 and listview first visible position haven't changed we can set header offset to last top position.

    opened by mozarcik 5
  • Feature request - adding action icons that float over header image

    Feature request - adding action icons that float over header image

    Just like in the Google Music app, it would be awesome to easily attach "floating" action buttons on top of a list, hovering over the header image but detached from it when you slide your list, so that it basically seems to be linked to the topmost list item. See red rectangle around the button in my screenshot.

    image

    If that could also be accomplished by the FadingActionBarHelper - wow! ;-)

    opened by Zordid 5
  • HoloEverywhere

    HoloEverywhere

    Hello,

    I would like to use it with HoloEverywhere library (https://github.com/Prototik/HoloEverywhere). When trying to use it, the library send me an error message saying that my activity should be an instance of SherlockActivity (and it is the HoloEverywhere activity...).

    Thnks and congrats for yout great work!!

    opened by fabriciomassula 4
  • Library Dependencies force my build to use appcompat-v7:23.0.0

    Library Dependencies force my build to use appcompat-v7:23.0.0

    compile 'com.android.support:appcompat-v7:22.0.0'
    compile 'com.github.manuelpeinado.fadingactionbar:fadingactionbar-abc:3.1.2'
    

    Even though I used to implement 22.0.0 in my build.gradle, the fadisngactionbar library now overrides the settings to install 23.0.0 library, rendering my app unbuildable due to missing v-23 constants:

    http://stackoverflow.com/questions/32092511/resource-error-in-android-studio-after-update-no-resource-found

    opened by VansonLeung 3
  • Can headerview be longer then screen height?

    Can headerview be longer then screen height?

    Im trying to make a header that sometimes is longer then my screen height, but for some reason the screen height of my device seems to be the maximum height the headerview can be.

    Is there any workarounds for this? To enable the headerviews height to become greater than the height?

    opened by joakim5937x 3
  • Header misplaced after scrolling down and turning off screen

    Header misplaced after scrolling down and turning off screen

    Great library, I'm loving it, but one thing has caught my attention. When scrolling down an activity, if you happen to turn off your screen and then scroll back up, the header image gets misplaced.

    Scroll down some and turn off screen.. 2013-12-02-18-48-10

    Scroll back up and you will see this :( 2013-12-02-18-48-43

    opened by JasonAndujar 3
  • Add aar to Maven Central

    Add aar to Maven Central

    It looks like you're already using Gradle. Accoding to http://gradleplease.appspot.com/ this library is available as an apklib but not aar.

    Would you mind adding it?

    opened by damianflannery 3
  • How to show toolbar when ScrollState to the top?

    How to show toolbar when ScrollState to the top?

    When I Scroll UP, toolbar is hide. When I Scroll DOWN, it shows toolbar . But when I Scroll DOWN, I want to show toolbar (ScrollState to the top). It have ScrollState.STOP. I thinks to check condition. `implements ObservableScrollViewCallbacks`
    
    toolbar = (Toolbar) findViewById(R.id.tool_bar);
    setSupportActionBar(toolbar);
    getSupportActionBar().setDisplayHomeAsUpEnabled(true);
    scrollView = (ObservableScrollView) findViewById(R.id.scroll);
    scrollView.setScrollViewCallbacks(this);
    
    @Override
    public void onScrollChanged(int scrollY, boolean firstScroll, boolean dragging) {
    
    }
    
    @Override
    public void onDownMotionEvent() {
    
    }
    
    @Override
    public void onUpOrCancelMotionEvent(ScrollState scrollState) {
        ActionBar ab = getSupportActionBar();
        if (ab == null) {
            return;
        }
        if (scrollState == ScrollState.UP) {
            if (ab.isShowing()) {
                ab.hide();
            }
        } else if (scrollState == ScrollState.DOWN) {
            if (!ab.isShowing()) {
                ab.show();
            }
        }
    }
    
    opened by ghost 0
  • How can I use this library with an ExpandableListView

    How can I use this library with an ExpandableListView

    I have already integrated this library with an ScrollView in another activity and it works Fine but I also need to use this with and Expandable ListView. There is no scroll on the header image when I try using the code in ListView Activity for my Expandable listview integration.

    Can anyone suggest solution please.

    opened by zohairshaikh 0
  • Need for Tutorial

    Need for Tutorial

    Hello Team, I loved the design layouts posted by your team.It would appreciate if you could include the steps to run the code in Android Studio SDK ! Thanks, Irene

    opened by irenemaria93 2
Owner
Manuel Peinado Gallego
Manuel Peinado Gallego
Android - a library that adds a glass-like effect to the action bar.

GlassActionBar GlassActionBar is an Android library which implements a glass-like effect for the action bar. The three most commonly used action bar i

Manuel Peinado Gallego 1.2k Nov 20, 2022
An example of how to extend the ActionBar under the status bar from the theme

Extended ActionBar The problem: Android 4.4 Kitkat introduced a wonderful new opportunity: translucent bars. It's as simple as adding the following to

Eugenio Marletti 160 Nov 11, 2022
An Android Library to help you create actionbar tabs like "Capitaine train" app by Cyril Mottier

TabBarView An Android Library to help you create actionbar tabs like "Capitaine train" app by Cyril Mottier Implementation: Declare TabBarView and set

Mirko Dimartino 510 Nov 15, 2022
PasswordStrengthView - an android library to represent password strength.

PasswordStrengthView - an android library to represent password strength.

null 33 Jan 3, 2022
News Stand app makes the ActionBar not boring!

No boring ActionBar http://flavienlaurent.com/blog/2013/11/20/making-your-action-bar-not-boring/ An explaination on how to implement the edition scree

Flavien Laurent 1.7k Oct 7, 2022
Android Application with Kotlin to easily see who's present and absent

Android Application with Kotlin to easily see who's present and absent The appli

Lucas Aries 1 Jan 3, 2022
Android library implementing a poppy view on scroll, similar to the one found in the Google Plus app

PoppyView PoppyView is a library which implements view on the bottom which come and go relative to the user scroll. It can be seen in the Google plus

Flavien Laurent 409 Nov 23, 2022
[] Action bar implementation which uses the native action bar on Android 4.0+ and a custom implementation on pre-4.0 through a single API and theme.

DEPRECATED ActionBarSherlock is deprecated. No more development will be taking place. For an up-to-date action bar backport use AppCompat. Thanks for

Jake Wharton 7.1k Dec 24, 2022
Android - a library that adds a glass-like effect to the action bar.

GlassActionBar GlassActionBar is an Android library which implements a glass-like effect for the action bar. The three most commonly used action bar i

Manuel Peinado Gallego 1.2k Nov 20, 2022
Android Application that plays music through a Spotify API based on a user's current location found through Google Maps API and also checking Google Weather API.

GeoStereo Android Application that plays music through a Spotify API based on a user's current location found through Google Maps API and also checkin

Jonah Douglas 1 Jun 16, 2022
Android Fading (Circle/ Custom Corner) Image

Android Fading (Circle/ Custom Corner) Image Implementation add maven { url 'https://jitpack.io' } to build.gradle in your project: allprojects {

Aghiad Odeh 1 Jul 5, 2022
Blade is an open source music player for Android, allowing you to play music from multiple services : files on your phone, Spotify, and more.

Blade Player Blade is an open source music player for Android, allowing you to play music from multiple services : files on your phone, Spotify, and m

Valentin HAUDIQUET 72 Jan 5, 2023
Automated-build-android-app-with-github-action - CI/CD Automated Build Android App Bundle / APK / Signed With Github Action

Automated Build Android With Using Github Action Project Github Action Script Us

Faisal Amir 34 Dec 19, 2022
Custom view to expand long text with view more,less action , you can customize min lines , action color

ExpandableTextView Custom expadable text view Examples : <mostafa.projects.expandabletextview.ExpandableTextView android:layout_wi

Mostafa Gad 8 Jan 25, 2022
A dual-function menu button that offers a default action as well as the possibility of choosing a different action by selecting from a set of alternatives.

A dual-function menu button that offers a default action as well as the possibility of choosing a different action by selecting from a set of alternatives.

Kojo Fosu Bempa Edue 114 Nov 29, 2022
Akka-in-action-kotlin - Accompanying source code for Akka in Action by Kotlin

Akka実践バイブル Kotlin版サンプルコード ( Accompanying source code for Akka in Action by Kotli

nrs 7 Jul 26, 2022
A Spotify Clone that plays music and has similar UI to actual Spotify Mobile App. Made with Exoplayer and love ❤️

Spotify Clone A Spotify Clone App that can play music, and has a good looking UI that is very similar to actual Spotify Mobile App on Play Store I use

Utku Oruç 4 Oct 12, 2022
A beautiful Fashion Store like Android App Mock built on Jetpack Compose with compose navigation, hilt, dark theme support and google's app architecture found on uplabs Here

A beautiful Fashion Store like Android App Mock built on Jetpack Compose with compose navigation, hilt, dark theme support and google's app architecture found on uplabs Here

Puncz 87 Nov 30, 2022
RecyclerView extension library which provides advanced features. (ex. Google's Inbox app like swiping, Play Music app like drag and drop sorting)

Advanced RecyclerView This RecyclerView extension library provides Google's Inbox app like swiping, Play Music app like drag-and-drop sorting and expa

Haruki Hasegawa 5.2k Dec 23, 2022