Android library for creating an expandable to full screen view inside a viewgroup composition.

Overview

Expandable Panel Android Library

Demo Screenshot 1 Demo Screenshot 2 Demo Screenshot 3 Demo Screenshot 4

Check ExpandablePanel Demo application on GooglePlay:
Get it on Google Play

Details

This Android library implements the expand by sliding logic for a top or a bottom view in a two children view composition. That's the default behaviour, but it allows you to set a different View as the expandable one, making this component support multiple views inside it. It supports Android SDK 2.1 (Eclair) as minimum.

ExpandablePanel library brings a custom view class called ExpandablePanelView to the final user. It implements the needed logic for integrating the expandable logic into your own Android application.

Custom Attributes

ExpandablePanel lib allows you to customize the following properties. Feel free to combine them to create cool user interfaces:

  • expandablepanel:completionPercent: % of the parent's height where you want the autocomplete animation to begin working.
  • expandablepanel:completeExpandAnimationSpeed: Speed for the autocomplete animation.
  • expandablepanel:completeShrinkAnimationSpeed: Speed for the autoshrink animation.
  • expandablepanel:beginExpanded: Use it if you need the topView to begin expanded. If that's your case, the view will play a bounce animation at start to inform the user about the hidden bottom view.
  • expandablepanel:bounceCount: Use it to set the number of times topView is going to play bounce animation when it begins expanded.
  • expandablepanel:invertBehavior: Use it to invert the panel's behaviour and make bottomView become the expandable one. You can combine it with any other custom attributes. Bounce animation will get inverted too when using this attr.
  • expandablepanel:animableViewId: Use it to assign an animable view using the view identifier if your ExpandablePanelView contains more than 2 child. This attribute is not mandatory, if you don't use it, first or second child (based on the expandablepanel:invertBehavior attribute) is going to be used as the animable view.
  • expandablepanel:autoAnimateOnClick: Use this one to enable automatic expanding or shrinking when user clicks on animable view.

Usage

In order to make it work, you will need to use ExpandablePanelView class into your Android XML Layout.

    1. Add ExpandablePanelView to the layout.
    1. Add two children views to the ExpandablePanelView XML element.
    1. ExpandablePanelView extends RelativeLayout, so you will need to give an android id to the top view and setup the android:below attribute in the bottom one.
    1. Set the xmlns:draggable_view="http://schemas.android.com/apk/res-auto" if you are going to use any of the cusom attributes.

Use ExpandableListener if you want your class to be able to get expandable callbacks. Following methods are offered to the user:

  • onExpandingStarted: Dispatched when the user starts expanding the view.
  • onExpandingFinished: Dispatched when autocomplete expanding animation is finished.
  • onShrinkStarted: Dispatched when the user starts shrinking the view.
  • onShrinkFinished: Dispatched when autocomplete shrinking animation is finished.
  • onExpandingTouchEvent: Dispatched meanwhile the user is dragging to expand or shrink the view. This one is very useful if you want to map touch coordinates to your class and be able to use them for creating cool combined animations.

Basic Usage

<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
    xmlns:tools="http://schemas.android.com/tools"
    xmlns:expandablepanel="http://schemas.android.com/apk/res-auto"
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    tools:context=".MainActivity">

    <com.jorgecastilloprz.expandablepanel.ExpandablePanelView
        android:layout_width="match_parent"
        android:layout_height="match_parent"
        android:background="@android:color/darker_gray"
        expandablepanel:completionPercent="0.8"
        expandablepanel:completeExpandAnimationSpeed="150"
        expandablepanel:completeShrinkAnimationSpeed="200">

        <ImageView
            android:id="@+id/topLayout"
            android:layout_width="match_parent"
            android:layout_height="250dp"
            android:src="@drawable/nightbackground"
            android:scaleType="centerCrop"/>

        <ImageView
            android:background="@color/material_pink"
            android:layout_width="match_parent"
            android:layout_height="match_parent"
            android:layout_below="@+id/topLayout"/>

    </com.jorgecastilloprz.expandablepanel.ExpandablePanelView>

</RelativeLayout>

Begin Expanded Usage:

<com.jorgecastilloprz.expandablepanel.ExpandablePanelView
        android:id="@+id/expandablePanelView"
        android:layout_width="match_parent"
        android:layout_height="match_parent"
        android:background="@android:color/darker_gray"
        expandablepanel:completionPercent="0.8"
        expandablepanel:completeExpandAnimationSpeed="150"
        expandablepanel:completeShrinkAnimationSpeed="200"
        expandablepanel:beginExpanded="true"
        expandablepanel:bounceCount="2">

    <ImageView
        android:id="@+id/topLayout"
        android:layout_width="match_parent"
        android:layout_height="250dp"
        android:src="@drawable/nightbackground"
        android:scaleType="centerCrop"/>

    <ImageView
        android:background="@color/material_pink"
        android:layout_width="match_parent"
        android:layout_height="match_parent"
        android:layout_below="@+id/topLayout"/>
    
</com.jorgecastilloprz.expandablepanel.ExpandablePanelView>

Invert Behaviour Usage:

  • You will need to remove android:layout_below from bottomView and add android:layout_above to the top one, in order to make Android capable of setting fixed bottomView height before topView match_parent height.
  • You must set android:layout_alignParentBottom="true" in bottom view too.
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
    xmlns:tools="http://schemas.android.com/tools"
    xmlns:expandablepanel="http://schemas.android.com/apk/res-auto"
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    tools:context=".MainActivity">

    <com.jorgecastilloprz.expandablepanel.ExpandablePanelView
        android:id="@+id/expandablePanelView"
        android:layout_width="match_parent"
        android:layout_height="match_parent"
        android:background="@android:color/darker_gray"
        expandablepanel:completionPercent="0.8"
        expandablepanel:completeExpandAnimationSpeed="150"
        expandablepanel:completeShrinkAnimationSpeed="200"
        expandablepanel:invertBehavior="true">

        <RelativeLayout
            android:id="@+id/topLayout"
            android:layout_width="match_parent"
            android:layout_height="match_parent"
            android:layout_above="@+id/bottomLayout">

            <LinearLayout
                android:layout_width="match_parent"
                android:layout_height="match_parent"
                android:orientation="vertical"
                android:weightSum="100">

                <ImageView
                    android:layout_width="match_parent"
                    android:layout_height="0dp"
                    android:layout_weight="99"
                    android:src="@drawable/nightbackground"
                    android:scaleType="centerCrop"/>

                <View
                    android:layout_width="match_parent"
                    android:layout_height="0dp"
                    android:layout_weight="1"
                    android:background="@color/flat_orange_bright" />

            </LinearLayout>

            <expandablepanel.jorgecastilloprz.com.expandablepanel.ui.components.CircledImageView
                android:id="@+id/avatar"
                android:layout_width="100dp"
                android:layout_height="100dp"
                android:src="@drawable/avatar"
                android:layout_centerInParent="true"/>


        </RelativeLayout>

        <ImageView
            android:id="@+id/bottomLayout"
            android:layout_width="match_parent"
            android:layout_height="300dp"
            android:src="@drawable/daybackground"
            android:scaleType="centerCrop"
            android:layout_alignParentBottom="true"/>

    </com.jorgecastilloprz.expandablepanel.ExpandablePanelView>

</RelativeLayout>

Import ExpandablePanel dependency

Add the next code to your build.gradle project dependencies:

dependencies {
    compile 'com.github.jorgecastilloprz:expandablepanel:1.0.4@aar'
}

Set the mavenCentral repo into the external build.gradle:

buildscript {
    repositories {
        mavenCentral()
    }
    dependencies {
        classpath 'com.android.tools.build:gradle:0.12.+'
    }
}

allprojects {
    repositories {
        mavenCentral()
    }
}

If you are using Maven, use the following code:

<dependency>
  <groupId>com.github.jorgecastilloprz</groupId>
  <artifactId>expandablepanel</artifactId>
  <version>1.0.4</version>
  <type>aar</type>
</dependency>

Developer

License

Copyright 2014 Jorge Castillo Pérez

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.
You might also like...
Sentinel is a simple one screen UI which provides a standardised entry point for tools used in development and QA alongside device, application and permissions data.
Sentinel is a simple one screen UI which provides a standardised entry point for tools used in development and QA alongside device, application and permissions data.

Sentinel Sentinel is a simple one screen UI that provides standardised entry point for tools used in development and QA alongside device, application

A simple screen that is shown when your app gets crashed instead of the normal crash dialog. It's very similar to the one in Flutter.
A simple screen that is shown when your app gets crashed instead of the normal crash dialog. It's very similar to the one in Flutter.

Red Screen Of Death What A simple screen that is shown when your app gets crashed instead of the normal crash dialog. It's very similar to the one in

Displays your screen time in a permanent notification.
Displays your screen time in a permanent notification.

Screen Time Displays your screen time in a permanent notification. By making screen time more prominent, you can get a better sense of how much of the

Android View for displaying and selecting values in a circle-shaped View, with animations and touch gestures.
Android View for displaying and selecting values in a circle-shaped View, with animations and touch gestures.

CircleDisplay Android View for displaying and selecting (by touch) values / percentages in a circle-shaped View, with animations. Features Core featur

FloatingView can make the target view floating above the anchor view with cool animation
FloatingView can make the target view floating above the anchor view with cool animation

FloatingView FloatingView can make the target view floating above the anchor view with cool animation Links 中文版 README Blog about FloatingView demo.ap

用于做Path动画的自定义View。 I have a path.I have a view. (Oh~),Path(Anim)View.
用于做Path动画的自定义View。 I have a path.I have a view. (Oh~),Path(Anim)View.

PathAnimView 用于做Path动画的自定义View。 I have a path.I have a view. (Oh~),Path(Anim)View. 现已经找到图片-SVG-PATH的正确姿势, Now i have a pic.I have a view. Oh~,Path(A

TourGuide is an Android library that aims to provide an easy way to add pointers with animations over a desired Android View

TourGuide TourGuide is an Android library. It lets you add pointer, overlay and tooltip easily, guiding users on how to use your app. Refer to the exa

A horizontal view scroller library for Android
A horizontal view scroller library for Android

View Flow for Android ViewFlow is an Android UI widget providing a horizontally scrollable ViewGroup with items populated from an Adapter. Scroll down

Android Quilt View Library
Android Quilt View Library

QuiltViewLibrary QuiltView displays views of different sizes in a scrollable grid. Dependencies This library depends on gridlayout_v7 ([email protected]:

Comments
  • OnClickListener method

    OnClickListener method

    It would be great if there were a method to detect a click event over an ExpandablePanelView's child to be able to start animation (forward and backward). I think it would be really intuitive.

    Cheers.

    opened by nelo686 2
  • Add attribute to customize animable view inside ExpandablePanelView

    Add attribute to customize animable view inside ExpandablePanelView

    With the current implementation library users has to use as animable view the child at position 0 or 1 depending on the expandablepanel:invertBehavior attribute. I've added a new styleable attribute to customize the animable view using a animableViewId.

    With this new feature you can add more views to your ExpandablePanelView and put the animable view at 0 or 1 position is not mandatory. This new attribute is not mandatory and library users doesn't have use it if they don't have more than two views inside ExpandablePanelView or the new child is above the second child view.

    I've updated two fragments with this new attribute and added more information in the README.md to explain the usage.

    opened by pedrovgs 2
  • Remove ic_launcher.png

    Remove ic_launcher.png

    With Android Gradle Plugin 1.2, I'm getting an error claiming a duplicate file:

    /workspace/project/app/build/intermediates/res/production/debug/drawable-hdpi-v4/ic_launcher.png: error: Duplicate file.
    /workspace/project/app/build/intermediates/res/production/debug/drawable-hdpi/ic_launcher.png: Original is here. The version qualifier may be implied.
    

    This is happening due to this library declaring ic_launcher.png. I can solve this on my project by renaming ic_launcher, but there's really no reason for a library to have this drawable anyway.

    opened by jrobinson3k1 5
Owner
Jorge Castillo
Senior Sofware Engineer @47deg
Jorge Castillo
A full options clock view

Clock View Full options Clock view. You are now able to create and design your own clock view with changing just attributes. Over 20 attributes are av

Belkilani Ahmed Radhouane 65 Dec 9, 2022
ExpandableSelector is an Android library created to show a list of Button/ImageButton widgets inside a animated container which can be collapsed or expanded.

ExpandableSelector ExpandableSelector is an Android library created to show a list of Button/ImageButton widgets inside a animated container which can

Karumi 699 Nov 19, 2022
Custom UI control for android which is showing data as a segments and a value inside them.

Segmented Bar View for Android Custom UI control for android which is showing data as a segments and a value inside them. Screenshots Install From rep

GSPD 354 Nov 10, 2022
A customizable debug screen to view and edit flags that can be used for development in Jetpack Compose applications

Tweaks A customizable debug screen to view and edit flags that can be used for development in Jetpack Compose applications To include the library add

Guillermo Merino Jiménez 4 Jan 14, 2022
This is a library to help creating expanding views with animation in Android

About the Library inspiration This library is strongly inspired in this concept from Hila Peleg in dribble. See it below Working example For more deta

Diego Bezerra 944 Dec 27, 2022
A powerful library for creating notifications in android platform.

Download Download the latest AAR or grab via Maven: <dependency> <groupId>com.github.halysongoncalves</groupId> <artifactId>pugnotification</artif

Halyson Lima Gonçalves 867 Nov 19, 2022
Android Material Json Form Wizard is a library for creating beautiful form based wizards within your app just by defining json in a particular format.

Android Json Wizard Android Json Wizard is a library for creating beautiful form based wizards within your app just by defining json in a particular f

Vijay Rawat 355 Nov 11, 2022
Library for creating blur effects under Android UI elements

BlurTutorial Meet BlurTutorial, an Android-based library made by Cleveroad Hurry to check our newest library that helps to blur the background in Andr

Cleveroad 150 Dec 16, 2022
Multiplatform UI DSL with screen management in common code for mobile (android & ios) Kotlin Multiplatform development

Mobile Kotlin widgets This is a Kotlin MultiPlatform library that provides declarative UI and application screens management in common code. You can i

IceRock Development 320 Dec 30, 2022
PCard Add payment card screen made using JetPack Compose

PCard Add payment card screen made using JetPack Compose Find this repository useful? ❤️ Support it by joining stargazers for this repository. ⭐ And f

Mohamed Elbehiry 61 Dec 16, 2022