ExpandableView


Source link: https://github.com/nicolasjafelle/ExpandableView

ExpandableView

ExpandableView is a View showing only a content and when clicked on it, it displays more content in a fashion way. You can add views or viewgroups but remember that it will only display the content in a LinearLayout with vertical orientation.

You can choose by default a "chevron" icon animation or a "plus" icon animation. The "always visible row" has a left icon, a text and finally a right icon which will be the animated one.

Instructions - Maven Central

  1. Add this library in your build.gradle:
dependencies {

  compile 'com.github.nicolasjafelle:expandableview:1.0' 
}

Instructions

  1. Clone the git repo
  2. Import the "ExpandableView" module into your Android-gradle project.
  3. Add "ExpandableView" module in your settings.gradle
  4. DONE

How to Use it

As any view in Android you can add it by code or by layout xml file but remember that if you want to change the default height of the visible content you need to use:

topExpandableView.setVisibleLayoutHeight(300);
 topExpandableView.setVisibleLayoutHeight(getResources().getDimensionPixelSize(R.dimen.new_height));

Remember also to fill the information inside the visible content by using:

expandableView.fillData(R.drawable.ic_android, R.string.android_names, true);
 //or expandableView.fillData(R.drawable.ic_android, getString(R.string.android_names), true);
 //or expandableView.fillData(R.drawable.ic_android, R.string.android_names, true);
 //or expandableView.fillData(R.drawable.ic_android, getString(R.string.android_names));
 //or expandableView.fillData(R.drawable.ic_android, R.string.android_names);
  //or expandableView.fillData(0, R.string.android_names);
 // No drawable left by passing 0.

If you want to add content into the discoverable LinearLayout simple use:

expandableView.addContentView(itemView);
 // itemView could be a simple TextView or more complex custom views

The most relevant part of this ExpandableView is when you want to include an ExpandableView into another ExpandableView, you need to pass the parent's View hierarchy, like this:

expandableViewLevel1.setOutsideContentLayout(topExpandableView.getContentLayout());
 // 1 Level expandableViewLevel2.setOutsideContentLayout(topExpandableView.getContentLayout(), expandableViewLevel1.getContentLayout());
 // 2 Levels expandableViewLevel3.setOutsideContentLayout(topExpandableView.getContentLayout(), expandableViewLevel1.getContentLayout(), expandableViewLevel2.getContentLayout());
 // 3 Levels

Also remember to use this package in your layout files:

<com.expandable.view.ExpandableView  android:id="@+id/activity_main_top_expandable_view"  android:layout_width="match_parent"  android:layout_height="wrap_content"/> 

You can also customize the TextView inside the visible Content Layout in this way:

<!-- Use this style name to override the default style --> <style name="ExpandableView_TextView">  <item name="android:textSize">18sp</item>  <item name="android:textStyle">bold</item>  <item name="android:textColor">@android:color/black</item> </style> 

Developed By

License

Copyright 2015 Nicolas Jafelle  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. 

Resources

With SnackbarAnimation class you can clone the Snackbar animation to move the ViewGroup above of the Snackbar when it is visible and avoid view overlapping (clone of fab animation).

Android Library for RecyclerView to manage order of items and multiple view types.

A simple ViewPager extends that provide scroll based animation like Jazz Hands for iOS.

This is a small library to create floating windows with balloons.

A very beautiful and easy-to-use app that allows to copy code to the user's clipboard, when user receives message verification code.

KAM

KAM is an apk manager, backup, restore and more.

Topics


2D Engines   3D Engines   9-Patch   Action Bars   Activities   ADB   Advertisements   Analytics   Animations   ANR   AOP   API   APK   APT   Architecture   Audio   Autocomplete   Background Processing   Backward Compatibility   Badges   Bar Codes   Benchmarking   Bitmaps   Bluetooth   Blur Effects   Bread Crumbs   BRMS   Browser Extensions   Build Systems   Bundles   Buttons   Caching   Camera   Canvas   Cards   Carousels   Changelog   Checkboxes   Cloud Storages   Color Analysis   Color Pickers   Colors   Comet/Push   Compass Sensors   Conferences   Content Providers   Continuous Integration   Crash Reports   Credit Cards   Credits   CSV   Curl/Flip   Data Binding   Data Generators   Data Structures   Database   Database Browsers   Date &   Debugging   Decompilers   Deep Links   Dependency Injections   Design   Design Patterns   Dex   Dialogs   Distributed Computing   Distribution Platforms   Download Managers   Drawables   Emoji   Emulators   EPUB   Equalizers &   Event Buses   Exception Handling   Face Recognition   Feedback &   File System   File/Directory   Fingerprint   Floating Action   Fonts   Forms   Fragments   FRP   FSM   Functional Programming   Gamepads   Games   Geocaching   Gestures   GIF   Glow Pad   Gradle Plugins   Graphics   Grid Views   Highlighting   HTML   HTTP Mocking   Icons   IDE   IDE Plugins   Image Croppers   Image Loaders   Image Pickers   Image Processing   Image Views   Instrumentation   Intents   Job Schedulers   JSON   Keyboard   Kotlin   Layouts   Library Demos   List View   List Views   Localization   Location   Lock Patterns   Logcat   Logging   Mails   Maps   Markdown   Mathematics   Maven Plugins   MBaaS   Media   Menus   Messaging   MIME   Mobile Web   Native Image   Navigation   NDK   Networking   NFC   NoSQL   Number Pickers   OAuth   Object Mocking   OCR Engines   OpenGL   ORM   Other Pickers   Parallax List   Parcelables   Particle Systems   Password Inputs   PDF   Permissions   Physics Engines   Platforms   Plugin Frameworks   Preferences   Progress Indicators   ProGuard   Properties   Protocol Buffer   Pull To   Purchases   Push/Pull   QR Codes   Quick Return   Radio Buttons   Range Bars   Ratings   Recycler Views   Resources   REST   Ripple Effects   RSS   Screenshots   Scripting   Scroll Views   SDK   Search Inputs   Security   Sensors   Services   Showcase Views   Signatures   Sliding Panels   Snackbars   SOAP   Social Networks   Spannable   Spinners   Splash Screens   SSH   Static Analysis   Status Bars   Styling   SVG   System   Tags   Task Managers   TDD &   Template Engines   Testing   Testing Tools   Text Formatting   Text Views   Text Watchers   Text-to   Toasts   Toolkits For   Tools   Tooltips   Trainings   TV   Twitter   Updaters   USB   User Stories   Utils   Validation   Video   View Adapters   View Pagers   Views   Watch Face   Wearable Data   Wearables   Weather   Web Tools   Web Views   WebRTC   WebSockets   Wheel Widgets   Wi-Fi   Widgets   Windows   Wizards   XML   XMPP   YAML   ZIP Codes