### Implement Full Expandable Layout Listener in Java Source: https://github.com/aakira/expandablelayout/blob/master/README.md This Java code shows how to set a comprehensive listener (`ExpandableLayoutListener`) on an `expandableLayout` instance to receive callbacks for various animation states, including start, end, pre-open/close, and opened/closed events. All methods must be overridden. ```Java expandableLayout.setListener(new ExpandableLayoutListener() { @Override public void onAnimationStart() { } @Override public void onAnimationEnd() { } // You can get notification that your expandable layout is going to open or close. // So, you can set the animation synchronized with expanding animation. @Override public void onPreOpen() { } @Override public void onPreClose() { } @Override public void onOpened() { } @Override public void onClosed() { } }); ``` -------------------------------- ### Define ExpandableRelativeLayout in XML Layout Source: https://github.com/aakira/expandablelayout/blob/master/README.md Shows how to define an `ExpandableRelativeLayout` in an Android XML layout file. It illustrates the use of custom attributes such as `ael_expanded` for initial state, `ael_duration` for animation speed, `ael_interpolator` for animation curve, and `ael_orientation` for expansion direction, along with nested `TextView` elements as example content. ```xml ``` -------------------------------- ### Apache License, Version 2.0 Text Source: https://github.com/aakira/expandablelayout/blob/master/README.md The standard Apache License, Version 2.0, which governs the usage, distribution, and modification of the software. It outlines permissions, conditions, and limitations, including patent grants and disclaimers of warranty. ```plaintext Copyright (C) 2015 A.Akira 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. ``` -------------------------------- ### Add Expandable Layout Library Dependency in Gradle Source: https://github.com/aakira/expandablelayout/blob/master/README.md This Groovy snippet shows how to add the `aakira:expandable-layout` library as a dependency in your Android project's `build.gradle` file. Ensure `jcenter()` is included in your repositories for dependency resolution. ```Groovy buildscript { repositories { jcenter() } } dependencies { compile 'com.github.aakira:expandable-layout:1.6.0@aar' } ``` -------------------------------- ### Use Expandable Layout Listener Adapter in Java Source: https://github.com/aakira/expandablelayout/blob/master/README.md This Java code demonstrates using `ExpandableLayoutListenerAdapter` for `expandableLayout`. This adapter allows you to override only the specific listener methods you need, such as `onPreOpen()` and `onPreClose()`, simplifying event handling. ```Java expandableLayout.setListener(new ExpandableLayoutListenerAdapter() { @Override public void onPreOpen() { } @Override public void onPreClose() { } }); ``` -------------------------------- ### Control ExpandableWeightLayout in Java Source: https://github.com/aakira/expandablelayout/blob/master/README.md Provides Java code for controlling an `ExpandableWeightLayout`, which is specifically designed for layouts that utilize weight attributes. It demonstrates the basic operations of toggling, expanding, and collapsing the layout programmatically. ```java ExpandableWeightLayout expandableLayout = (ExpandableWeightLayout) findViewById(R.id.expandableLayout); // toggle expand, collapse expandableLayout.toggle(); // expand expandableLayout.expand(); // collapse expandableLayout.collapse(); ``` -------------------------------- ### Manage ExpandableLinearLayout in Java Source: https://github.com/aakira/expandablelayout/blob/master/README.md Illustrates how to use `ExpandableLinearLayout` for layouts where child views may change size dynamically, such as when fetching data from a server. It also demonstrates how to properly configure it for use within a `RecyclerView` by disabling recyclability on the ViewHolder and setting the `inRecyclerView` flag on the layout itself. ```java // resize expandable layout ExpandableLinearLayout expandableLayout = (ExpandableLinearLayout) findViewById(R.id.expandableLayout); child.setText("Sets text from a server"); expandableLayout.initLayout(); // Recalculate size of children // recycler view // you must set a ViewHolder#setIsRecyclable(false) and ExpandableLinearLayout#setInRecyclerView(true) @Override public void onBindViewHolder(final ViewHolder holder, final int position) { holder.setIsRecyclable(false); holder.expandableLinearLayout.setInRecyclerView(true); } ``` -------------------------------- ### Define Expandable Layout in Android XML Source: https://github.com/aakira/expandablelayout/blob/master/README.md This XML snippet demonstrates how to integrate `ExpandableWeightLayout` into an Android layout, setting its width, height, weight, and custom attributes like `ael_duration` and `ael_interpolator` for animation. Remember to add the `xmlns:app` namespace. ```XML ``` -------------------------------- ### Control ExpandableRelativeLayout in Java Source: https://github.com/aakira/expandablelayout/blob/master/README.md Demonstrates how to programmatically control an `ExpandableRelativeLayout` instance in Java. This includes methods for toggling, expanding, collapsing, moving child views by index, and setting an optional position or a base close position. This layout is suitable when child view sizes are static. ```java ExpandableRelativeLayout expandableLayout = (ExpandableRelativeLayout) findViewById(R.id.expandableLayout); // toggle expand, collapse expandableLayout.toggle(); // expand expandableLayout.expand(); // collapse expandableLayout.collapse(); // move position of child view expandableLayout.moveChild(0); // move optional position expandableLayout.move(500); // set base position which is close position expandableLayout.setClosePosition(500); ``` -------------------------------- ### Supported Interpolators for Expandable Layout Animations Source: https://github.com/aakira/expandablelayout/blob/master/README.md This section lists the Android `Interpolator` classes supported by the expandable layout library and their corresponding attribute `value name` for use in XML. These interpolators define the rate of change of an animation, affecting its visual feel. Note that some interpolators (e.g., `AnticipateInterpolator`) may not work correctly if the layout extends outside its bounds. ```APIDOC AccelerateDecelerateInterpolator: accelerateDecelerate AccelerateInterpolator: accelerate AnticipateInterpolator: anticipate AnticipateOvershootInterpolator: anticipateOvershoot BounceInterpolator: bounce DecelerateInterpolator: decelerate FastOutLinearInInterpolator: fastOutLinearIn FastOutSlowInInterpolator: fastOutSlowIn LinearInterpolator: linear LinearOutSlowInInterpolator: linearOutSlowIn OvershootInterpolator: overshoot Not supported: CycleInterpolator PathInterpolator ``` -------------------------------- ### Expandable Layout Custom XML Attributes Source: https://github.com/aakira/expandablelayout/blob/master/README.md This section details the custom XML attributes available for configuring `ExpandableWeightLayout` and `ExpandableRelativeLayout`. These attributes control animation duration, initial expansion state, default child index/position, orientation, and the interpolator used for animations. ```APIDOC ael_duration: The length of the expand or collapse animation ael_expanded: The layout is expanded if you set true ael_defaultChildIndex: The layout is expanded at index of child view. (Only `ExpandableRelativeLayout`) ael_defaultPosition: The layout is expanded at the position. (Only `ExpandableRelativeLayout`) ael_orientation: The orientation of animation (horizontal | vertical) ael_interpolator: Sets interpolator for animation ``` === COMPLETE CONTENT === This response contains all available snippets from this library. No additional content exists. Do not make further requests.