├── app ├── .gitignore ├── src │ ├── main │ │ ├── res │ │ │ ├── values │ │ │ │ ├── strings.xml │ │ │ │ ├── dimens.xml │ │ │ │ ├── colors.xml │ │ │ │ └── styles.xml │ │ │ ├── mipmap-hdpi │ │ │ │ └── ic_launcher.png │ │ │ ├── mipmap-mdpi │ │ │ │ └── ic_launcher.png │ │ │ ├── mipmap-xhdpi │ │ │ │ └── ic_launcher.png │ │ │ ├── mipmap-xxhdpi │ │ │ │ ├── ic_launcher.png │ │ │ │ ├── icon_click_up.png │ │ │ │ └── ic_expand_more.png │ │ │ ├── mipmap-xxxhdpi │ │ │ │ └── ic_launcher.png │ │ │ ├── values-w820dp │ │ │ │ └── dimens.xml │ │ │ └── layout │ │ │ │ ├── item_expandble_view.xml │ │ │ │ ├── activity_model.xml │ │ │ │ ├── item_expenable.xml │ │ │ │ ├── item_expanble_querycar.xml │ │ │ │ ├── item_expanble_caruniques.xml │ │ │ │ ├── item_expanble_recycle.xml │ │ │ │ └── activity_main.xml │ │ ├── java │ │ │ └── view │ │ │ │ └── waitou │ │ │ │ └── expandableview │ │ │ │ ├── UniquesInfo.java │ │ │ │ ├── QueryInfo.java │ │ │ │ ├── ModelActivity.java │ │ │ │ ├── MainActivity.java │ │ │ │ └── ExpandableViewAdapter.java │ │ └── AndroidManifest.xml │ ├── test │ │ └── java │ │ │ └── view │ │ │ └── waitou │ │ │ └── expandableview │ │ │ └── ExampleUnitTest.java │ └── androidTest │ │ └── java │ │ └── view │ │ └── waitou │ │ └── expandableview │ │ └── ExampleInstrumentedTest.java ├── proguard-rules.pro └── build.gradle ├── explibrary ├── .gitignore ├── src │ ├── main │ │ ├── AndroidManifest.xml │ │ ├── res │ │ │ └── values │ │ │ │ └── attrs.xml │ │ └── java │ │ │ └── view │ │ │ └── waitou │ │ │ └── explibrary │ │ │ └── ExpandableView.java │ ├── test │ │ └── java │ │ │ └── view │ │ │ └── waitou │ │ │ └── explibrary │ │ │ └── ExampleUnitTest.java │ └── androidTest │ │ └── java │ │ └── view │ │ └── waitou │ │ └── explibrary │ │ └── ExampleInstrumentedTest.java ├── proguard-rules.pro └── build.gradle ├── settings.gradle ├── Untitled20.gif ├── Untitled21.gif ├── gradle └── wrapper │ ├── gradle-wrapper.jar │ └── gradle-wrapper.properties ├── .gitignore ├── README.md ├── gradlew.bat └── gradlew /app/.gitignore: -------------------------------------------------------------------------------- 1 | /build 2 | -------------------------------------------------------------------------------- /explibrary/.gitignore: -------------------------------------------------------------------------------- 1 | /build 2 | -------------------------------------------------------------------------------- /settings.gradle: -------------------------------------------------------------------------------- 1 | include ':app', ':explibrary' 2 | -------------------------------------------------------------------------------- /Untitled20.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/zguop/ExpandableView/HEAD/Untitled20.gif -------------------------------------------------------------------------------- /Untitled21.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/zguop/ExpandableView/HEAD/Untitled21.gif -------------------------------------------------------------------------------- /gradle/wrapper/gradle-wrapper.jar: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/zguop/ExpandableView/HEAD/gradle/wrapper/gradle-wrapper.jar -------------------------------------------------------------------------------- /app/src/main/res/values/strings.xml: -------------------------------------------------------------------------------- 1 | 2 | ExpandableView 3 | 4 | -------------------------------------------------------------------------------- /app/src/main/res/mipmap-hdpi/ic_launcher.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/zguop/ExpandableView/HEAD/app/src/main/res/mipmap-hdpi/ic_launcher.png -------------------------------------------------------------------------------- /app/src/main/res/mipmap-mdpi/ic_launcher.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/zguop/ExpandableView/HEAD/app/src/main/res/mipmap-mdpi/ic_launcher.png -------------------------------------------------------------------------------- /app/src/main/res/mipmap-xhdpi/ic_launcher.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/zguop/ExpandableView/HEAD/app/src/main/res/mipmap-xhdpi/ic_launcher.png -------------------------------------------------------------------------------- /app/src/main/res/mipmap-xxhdpi/ic_launcher.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/zguop/ExpandableView/HEAD/app/src/main/res/mipmap-xxhdpi/ic_launcher.png -------------------------------------------------------------------------------- /app/src/main/res/mipmap-xxhdpi/icon_click_up.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/zguop/ExpandableView/HEAD/app/src/main/res/mipmap-xxhdpi/icon_click_up.png -------------------------------------------------------------------------------- /app/src/main/res/mipmap-xxxhdpi/ic_launcher.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/zguop/ExpandableView/HEAD/app/src/main/res/mipmap-xxxhdpi/ic_launcher.png -------------------------------------------------------------------------------- /app/src/main/res/mipmap-xxhdpi/ic_expand_more.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/zguop/ExpandableView/HEAD/app/src/main/res/mipmap-xxhdpi/ic_expand_more.png -------------------------------------------------------------------------------- /app/src/main/res/values/dimens.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 16dp 4 | 16dp 5 | 6 | -------------------------------------------------------------------------------- /gradle/wrapper/gradle-wrapper.properties: -------------------------------------------------------------------------------- 1 | #Thu Aug 02 10:31:45 CST 2018 2 | distributionBase=GRADLE_USER_HOME 3 | distributionPath=wrapper/dists 4 | zipStoreBase=GRADLE_USER_HOME 5 | zipStorePath=wrapper/dists 6 | distributionUrl=https\://services.gradle.org/distributions/gradle-5.1.1-all.zip 7 | -------------------------------------------------------------------------------- /app/src/main/java/view/waitou/expandableview/UniquesInfo.java: -------------------------------------------------------------------------------- 1 | package view.waitou.expandableview; 2 | 3 | /** 4 | * Created by waitou on 16/9/24. 5 | * 物流二层车架列表 6 | */ 7 | public class UniquesInfo { 8 | 9 | public boolean delivered; 10 | 11 | public String snap; 12 | 13 | } 14 | -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | *.iml 2 | .gradle 3 | /local.properties 4 | .DS_Store 5 | /build 6 | /captures 7 | .externalNativeBuild 8 | *.apk 9 | *.ap_ 10 | *.dex 11 | *.class 12 | bin/ 13 | gen/ 14 | # Log Files 15 | *.log 16 | .navigation/ 17 | .idea/ 18 | gradle.properties 19 | .bash_profile 20 | reports 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | -------------------------------------------------------------------------------- /app/src/main/java/view/waitou/expandableview/QueryInfo.java: -------------------------------------------------------------------------------- 1 | package view.waitou.expandableview; 2 | 3 | import java.util.List; 4 | 5 | /** 6 | * Created by waitou on 16/9/24. 7 | */ 8 | public class QueryInfo { 9 | 10 | public List uniques; 11 | 12 | public String name; 13 | 14 | public boolean finished; 15 | 16 | } 17 | -------------------------------------------------------------------------------- /explibrary/src/main/AndroidManifest.xml: -------------------------------------------------------------------------------- 1 | 3 | 4 | 7 | 8 | 9 | 10 | 11 | -------------------------------------------------------------------------------- /app/src/main/res/values/colors.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | #3F51B5 4 | #303F9F 5 | #FF4081 6 | 7 | #E7E7E7 8 | #FF9003 9 | 10 | -------------------------------------------------------------------------------- /app/src/main/res/values-w820dp/dimens.xml: -------------------------------------------------------------------------------- 1 | 2 | 5 | 64dp 6 | 7 | -------------------------------------------------------------------------------- /explibrary/src/main/res/values/attrs.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | -------------------------------------------------------------------------------- /app/src/test/java/view/waitou/expandableview/ExampleUnitTest.java: -------------------------------------------------------------------------------- 1 | package view.waitou.expandableview; 2 | 3 | import org.junit.Test; 4 | 5 | import static org.junit.Assert.*; 6 | 7 | /** 8 | * Example local unit test, which will execute on the development machine (host). 9 | * 10 | * @see Testing documentation 11 | */ 12 | public class ExampleUnitTest { 13 | @Test 14 | public void addition_isCorrect() throws Exception { 15 | assertEquals(4, 2 + 2); 16 | } 17 | } -------------------------------------------------------------------------------- /explibrary/src/test/java/view/waitou/explibrary/ExampleUnitTest.java: -------------------------------------------------------------------------------- 1 | package view.waitou.explibrary; 2 | 3 | import org.junit.Test; 4 | 5 | import static org.junit.Assert.*; 6 | 7 | /** 8 | * Example local unit test, which will execute on the development machine (host). 9 | * 10 | * @see Testing documentation 11 | */ 12 | public class ExampleUnitTest { 13 | @Test 14 | public void addition_isCorrect() throws Exception { 15 | assertEquals(4, 2 + 2); 16 | } 17 | } -------------------------------------------------------------------------------- /app/src/main/res/layout/item_expandble_view.xml: -------------------------------------------------------------------------------- 1 | 2 | 6 | 7 | -------------------------------------------------------------------------------- /app/src/main/res/values/styles.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 10 | 11 | 12 | 13 | 18 | 19 | 20 | -------------------------------------------------------------------------------- /app/proguard-rules.pro: -------------------------------------------------------------------------------- 1 | # Add project specific ProGuard rules here. 2 | # By default, the flags in this file are appended to flags specified 3 | # in /Users/waitou/Library/Android/sdk/tools/proguard/proguard-android.txt 4 | # You can edit the include path and order by changing the proguardFiles 5 | # directive in build.gradle. 6 | # 7 | # For more details, see 8 | # http://developer.android.com/guide/developing/tools/proguard.html 9 | 10 | # Add any project specific keep options here: 11 | 12 | # If your project uses WebView with JS, uncomment the following 13 | # and specify the fully qualified class name to the JavaScript interface 14 | # class: 15 | #-keepclassmembers class fqcn.of.javascript.interface.for.webview { 16 | # public *; 17 | #} 18 | -------------------------------------------------------------------------------- /explibrary/proguard-rules.pro: -------------------------------------------------------------------------------- 1 | # Add project specific ProGuard rules here. 2 | # By default, the flags in this file are appended to flags specified 3 | # in /Users/waitou/Library/Android/sdk/tools/proguard/proguard-android.txt 4 | # You can edit the include path and order by changing the proguardFiles 5 | # directive in build.gradle. 6 | # 7 | # For more details, see 8 | # http://developer.android.com/guide/developing/tools/proguard.html 9 | 10 | # Add any project specific keep options here: 11 | 12 | # If your project uses WebView with JS, uncomment the following 13 | # and specify the fully qualified class name to the JavaScript interface 14 | # class: 15 | #-keepclassmembers class fqcn.of.javascript.interface.for.webview { 16 | # public *; 17 | #} 18 | -------------------------------------------------------------------------------- /app/build.gradle: -------------------------------------------------------------------------------- 1 | apply plugin: 'com.android.application' 2 | 3 | android { 4 | compileSdkVersion 27 5 | defaultConfig { 6 | applicationId "view.waitou.expandableview" 7 | minSdkVersion 15 8 | targetSdkVersion 27 9 | versionCode 1 10 | versionName "1.0" 11 | testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner" 12 | } 13 | buildTypes { 14 | release { 15 | minifyEnabled false 16 | proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro' 17 | } 18 | } 19 | } 20 | 21 | dependencies { 22 | implementation 'com.android.support:appcompat-v7:27.1.1' 23 | implementation 'com.android.support:recyclerview-v7:27.1.1' 24 | implementation project(':explibrary') 25 | } 26 | -------------------------------------------------------------------------------- /app/src/main/AndroidManifest.xml: -------------------------------------------------------------------------------- 1 | 2 | 4 | 5 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | -------------------------------------------------------------------------------- /app/src/main/res/layout/activity_model.xml: -------------------------------------------------------------------------------- 1 | 2 | 8 | 9 | 12 | 13 | 14 | 19 | 20 | 21 | 22 | 23 | -------------------------------------------------------------------------------- /app/src/main/res/layout/item_expenable.xml: -------------------------------------------------------------------------------- 1 | 2 | 8 | 9 | 19 | -------------------------------------------------------------------------------- /app/src/androidTest/java/view/waitou/expandableview/ExampleInstrumentedTest.java: -------------------------------------------------------------------------------- 1 | package view.waitou.expandableview; 2 | 3 | import android.content.Context; 4 | import android.support.test.InstrumentationRegistry; 5 | import android.support.test.runner.AndroidJUnit4; 6 | 7 | import org.junit.Test; 8 | import org.junit.runner.RunWith; 9 | 10 | import static org.junit.Assert.*; 11 | 12 | /** 13 | * Instrumentation test, which will execute on an Android device. 14 | * 15 | * @see Testing documentation 16 | */ 17 | @RunWith(AndroidJUnit4.class) 18 | public class ExampleInstrumentedTest { 19 | @Test 20 | public void useAppContext() throws Exception { 21 | // Context of the app under test. 22 | Context appContext = InstrumentationRegistry.getTargetContext(); 23 | 24 | assertEquals("view.waitou.expandableview", appContext.getPackageName()); 25 | } 26 | } 27 | -------------------------------------------------------------------------------- /explibrary/src/androidTest/java/view/waitou/explibrary/ExampleInstrumentedTest.java: -------------------------------------------------------------------------------- 1 | package view.waitou.explibrary; 2 | 3 | import android.content.Context; 4 | import android.support.test.InstrumentationRegistry; 5 | import android.support.test.runner.AndroidJUnit4; 6 | 7 | import org.junit.Test; 8 | import org.junit.runner.RunWith; 9 | 10 | import static org.junit.Assert.*; 11 | 12 | /** 13 | * Instrumentation test, which will execute on an Android device. 14 | * 15 | * @see Testing documentation 16 | */ 17 | @RunWith(AndroidJUnit4.class) 18 | public class ExampleInstrumentedTest { 19 | @Test 20 | public void useAppContext() throws Exception { 21 | // Context of the app under test. 22 | Context appContext = InstrumentationRegistry.getTargetContext(); 23 | 24 | assertEquals("view.waitou.explibrary.test", appContext.getPackageName()); 25 | } 26 | } 27 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # ExpandableView 2 | 3 | 动画列表展开收起 ,列表右边的指示箭头可以再任何位置 4 | 当展开时如果超过屏幕的高度时父控件自动上移,滚动的父布局可以是RecyclerView,ScrollView 5 | 6 | [![](https://jitpack.io/v/zguop/ExpandableView.svg)](https://jitpack.io/#zguop/ExpandableView) 7 | 8 | ### 效果图: 9 | 10 | ![这里写图片描述](Untitled20.gif) ![这里写图片描述](Untitled21.gif) 11 | 12 | 13 | Then, add the library to your module `build.gradle` 14 | ```gradle 15 | dependencies { 16 | compile 'com.to.aboomy:explibrary:2.0.2' 17 | } 18 | ``` 19 | ### 使用方式 20 | 21 | ```groovy 22 | 23 | final ExpandableView expandableView = holder.getView(R.id.item_expanble); 24 | expandableView.setAdapter(queryInfo.uniques.size(), new ExpandableView.OnBindListener() { 25 | 26 | @Override 27 | public View bindTitleView(View titleView) { 28 | if (titleView == null) { 29 | titleView = View.inflate(mContext, R.layout.item_expanble_querycar, null); 30 | } 31 | //设置箭头id 32 | holder1.mExpandingList.setArrowAnimationView(R.id.iv_arrow); 33 | 34 | //头部数据绑定... 35 | 36 | ... 37 | return titleView; 38 | } 39 | 40 | @Override 41 | public View bindChildView(int childPos, View child) { 42 | if(child == null){ 43 | child = View.inflate(mContext,R.layout.item_expanble_caruniques,null); 44 | } 45 | //列表布局 数据绑定 46 | ... 47 | return child; 48 | } 49 | 50 | //返回true 列表展开收起 都将重新调用 bindTitleView bindChildView方法 适用于数据变化 51 | @Override 52 | public boolean expandableUpDataView() { 53 | return true; 54 | } 55 | }); 56 | ``` 57 | -------------------------------------------------------------------------------- /app/src/main/res/layout/item_expanble_querycar.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 8 | 9 | 13 | 14 | 22 | 23 | 34 | 35 | 36 | 40 | 41 | -------------------------------------------------------------------------------- /app/src/main/res/layout/item_expanble_caruniques.xml: -------------------------------------------------------------------------------- 1 | 2 | 7 | 8 | 11 | 12 | 22 | 23 | 24 | 36 | 37 | 38 | 39 | 43 | -------------------------------------------------------------------------------- /app/src/main/res/layout/item_expanble_recycle.xml: -------------------------------------------------------------------------------- 1 | 2 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | -------------------------------------------------------------------------------- /app/src/main/res/layout/activity_main.xml: -------------------------------------------------------------------------------- 1 | 2 | 10 | 11 |