Coder Social home page Coder Social logo

log-tag / materialexpansionpanel Goto Github PK

View Code? Open in Web Editor NEW

This project forked from robertlevonyan/material-expansion-panel

0.0 2.0 0.0 9.59 MB

Expansion panels contain creation flows and allow lightweight editing of an element.

License: Apache License 2.0

Java 100.00%

materialexpansionpanel's Introduction

Material Expansion Panel

Expansion panels contain creation flows and allow lightweight editing of an element.

Android Arsenal

Setup

Gradle:

Add following line of code to your module(app) level gradle file

    implementation 'com.robertlevonyan.view:MaterialExpansionPanel:1.2.0'

Maven:

<dependency>
  <groupId>com.robertlevonyan.view</groupId>
  <artifactId>MaterialExpansionPanel</artifactId>
  <version>1.2.0</version>
  <type>pom</type>
</dependency>

Usage

<com.robertlevonyan.views.expandable.Expandable
        android:id="@+id/expandable"
        android:layout_width="match_parent"
        android:layout_height="wrap_content">

        <include
            android:id="@+id/header"
            layout="@layout/header_view" />

        <include
            android:id="@+id/content"
            layout="@layout/content_view" />
</com.robertlevonyan.views.expandable.Expandable>
alt text alt text

Material Expansion Panel in action

alt text

Attributes

Custom Atributes Description
app:exp_icon Icon for Expandable Header
app:exp_iconStyle Set style for header icon: square, circle or roundedSquare
app:exp_animateExpand Animate expand of layout
app:exp_backgroundColor Set a custom background color for layout
app:exp_headerBackgroundColor Set a custom background color for layout header
app:exp_expandIndicator Select custom drawable for expand indicator

Setting Listeners

    Expandable expandable = findViewById(R.id.expandable);

Set expand listener

    expandable.setExpandingListener(new ExpandingListener() {
            @Override
            public void onExpanded() {
                //some stuff on expand
            }

            @Override
            public void onCollapsed() {
                //some stuff on collapse
            }
        });

Customizing Expandable from Java

    expandable.setIcon(); // Icon for Expandable Header
    expandable.setIconStyle(); // Set style for header icon: square, circle or roundedSquare
    expandable.setAnimateExpand(); // Animate layout expanding
    expandable.changeBackgroundColor(); // Set a custom background color for layout
    expandable.setHeaderBackgroundColor(); // Set a custom background color for layout header
    expandable.setExpandIndicatorDrawable(); // Select custom drawable for expand indicator
    expandable.setExpandIndicator(); // Select custom drawable resource for expand indicator

Usage in RecyclerView

Inside onBindViewHolder() add this after getting the instance of Expandable

    expandable.requestLayout();

Add code below to your Adapter class

    @Override
    public int getItemViewType(int position) {
        return position;
    }

Versions

1.2.0

RecyclerView issue fixed

1.1.0

New version with bug fixes

1.0.0

First version of library

Licence

    Material Expansion Panel©
    Copyright 2017 Robert Levonyan
    Url: https://github.com/robertlevonyan/materialExpansionPanel

    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.

materialexpansionpanel's People

Contributors

robertlevonyan avatar

Watchers

 avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.