├── .gitignore ├── .idea ├── compiler.xml ├── copyright │ └── profiles_settings.xml ├── encodings.xml ├── gradle.xml ├── misc.xml ├── modules.xml ├── runConfigurations.xml └── vcs.xml ├── README.md ├── app ├── .gitignore ├── build.gradle ├── proguard-rules.pro └── src │ ├── androidTest │ └── java │ │ └── com │ │ └── lqr │ │ └── ExampleInstrumentedTest.java │ ├── main │ ├── AndroidManifest.xml │ ├── java │ │ └── com │ │ │ └── lqr │ │ │ ├── Demo1Activity.java │ │ │ ├── Demo2Activity.java │ │ │ └── MainActivity.java │ └── res │ │ ├── layout │ │ ├── activity_demo1.xml │ │ ├── activity_demo2.xml │ │ └── activity_main.xml │ │ ├── mipmap-hdpi │ │ └── ic_launcher.png │ │ ├── mipmap-mdpi │ │ └── ic_launcher.png │ │ ├── mipmap-xhdpi │ │ └── ic_launcher.png │ │ ├── mipmap-xxhdpi │ │ ├── ic_dropdown_actived.png │ │ ├── ic_dropdown_normal.png │ │ ├── ic_launcher.png │ │ └── ic_task_status_list_check.png │ │ ├── mipmap-xxxhdpi │ │ └── ic_launcher.png │ │ ├── values-w820dp │ │ └── dimens.xml │ │ └── values │ │ ├── colors.xml │ │ ├── dimens.xml │ │ ├── strings.xml │ │ └── styles.xml │ └── test │ └── java │ └── com │ └── lqr │ └── ExampleUnitTest.java ├── build.gradle ├── gradle.properties ├── gradle └── wrapper │ ├── gradle-wrapper.jar │ └── gradle-wrapper.properties ├── gradlew ├── gradlew.bat ├── library ├── .gitignore ├── build.gradle ├── proguard-rules.pro └── src │ ├── androidTest │ └── java │ │ └── com │ │ └── lqr │ │ └── dropdownLayout │ │ └── ExampleInstrumentedTest.java │ ├── main │ ├── AndroidManifest.xml │ ├── java │ │ └── com │ │ │ └── lqr │ │ │ └── dropdownLayout │ │ │ ├── LQRDropdownLayout.java │ │ │ └── ref │ │ │ ├── LQRDropdownButton.java │ │ │ ├── LQRDropdownItemObject.java │ │ │ ├── LQRDropdownListItemView.java │ │ │ └── LQRDropdownListView.java │ └── res │ │ ├── anim │ │ ├── dropdown_in.xml │ │ ├── dropdown_mask_out.xml │ │ └── dropdown_out.xml │ │ ├── layout │ │ ├── dropdown_tab_button.xml │ │ └── dropdown_tab_list.xml │ │ └── values │ │ ├── attrs_lqr_dropdown_layout.xml │ │ └── strings.xml │ └── test │ └── java │ └── com │ └── lqr │ └── dropdownLayout │ └── ExampleUnitTest.java ├── screenshots ├── 1.gif └── 2.gif └── settings.gradle /.gitignore: -------------------------------------------------------------------------------- 1 | *.iml 2 | .gradle 3 | /local.properties 4 | /.idea/workspace.xml 5 | /.idea/libraries 6 | .DS_Store 7 | /build 8 | /captures 9 | .externalNativeBuild 10 | -------------------------------------------------------------------------------- /.idea/compiler.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | -------------------------------------------------------------------------------- /.idea/copyright/profiles_settings.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | -------------------------------------------------------------------------------- /.idea/encodings.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | -------------------------------------------------------------------------------- /.idea/gradle.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 18 | 19 | -------------------------------------------------------------------------------- /.idea/misc.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 12 | 13 | 14 | 26 | 36 | 37 | 38 | 39 | 40 | 41 | 42 | 43 | 44 | 45 | 46 | 47 | 48 | 49 | 50 | 51 | 53 | -------------------------------------------------------------------------------- /.idea/modules.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | -------------------------------------------------------------------------------- /.idea/runConfigurations.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 11 | 12 | -------------------------------------------------------------------------------- /.idea/vcs.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # LQRDropdownLayoutLibrary 2 | 下拉导航菜单,使用非常简单 3 | 4 | 5 | ## ***LQRDropdownLayout*** 6 | 该项目是下拉导航菜单,使用非常简单。基于FilterDropDownMenu-master项目进行封装,因为原项目的使用太复杂了,光布局就得几十行代码,如果项目中多处用到下拉菜单,那代码的冗余度就太大了,故本布局对其进行精简,并增加更多效果(如:选中时条目的背景及旁边的图标都可自定义等),使用时仅仅只要2个步骤: 7 | 8 | ### 1、导入 9 | 10 | compile 'com.lqr.dropdownLayout:library:1.0.0' 11 | 12 | ### 2、设置布局 13 | 14 | 23 | 24 | ### 3、代码控制 25 | 26 | LQRDropdownLayout mDl = (LQRDropdownLayout) findViewById(R.id.dl); 27 | mDl.setCols(2); 28 | 29 | //创建内容区 30 | TextView tv = new TextView(this); 31 | tv.setText("我是内容,可以是View,也可以是ViewGroup"); 32 | 33 | //创建下拉列表数据 34 | final List> listData = new ArrayList<>(); 35 | for (int i = 0; i < mDl.getCols(); i++) { 36 | //这里使用LinkedHashMap是为了让下拉列表的条目有序 37 | Map map = new LinkedHashMap<>(); 38 | for (int j = 0; j < 6; j++) { 39 | map.put("name " + j, "value " + j); 40 | } 41 | listData.add(map); 42 | } 43 | 44 | //初始化(该方法必须调用) 45 | mDl.init(tv, listData); 46 | //设置菜单点击监听 47 | mDl.setOnDropdownListListener(new LQRDropdownLayout.OnDropdownListListener() { 48 | @Override 49 | public void OnDropdownListSelected(int indexOfButton, int indexOfList, String textOfList, String valueOfList) { 50 | 51 | } 52 | 53 | @Override 54 | public void onDropdownListOpen() { 55 | 56 | } 57 | 58 | @Override 59 | public void onDropdownListClosed() { 60 | 61 | } 62 | }); 63 | 64 | 65 | ### 4、可实现的效果如下: 66 | 67 | ![image](screenshots/1.gif) 68 | ![image](screenshots/2.gif) 69 | 70 | ### 5、其他设置 71 | 由于该控件的可自定义属性太多,这里就一一举例了,请看其自定义属性 72 | 73 | 74 | 75 | 76 | 77 | 78 | 79 | 80 | 81 | 82 | 83 | 84 | 85 | 86 | 87 | 88 | 89 | 90 | 91 | 92 | 93 | 94 | 95 | 96 | 97 | 98 | 99 | 100 | 101 | 102 | 103 | 104 | 105 | 106 | 107 | 108 | 109 | 110 | 111 | 112 | 113 | 114 | 115 | 116 | 117 | 118 | 119 | 120 | 121 | 122 | 123 | 124 | 125 | 126 | 127 | 128 | 129 | 130 | 131 | 132 | 133 | 134 | 135 | 136 | 137 | 138 | 139 | 140 | 141 | 142 | 143 | 144 | 145 | 146 | 147 | 148 | 149 | 150 | 151 | 152 | 153 | 154 | 155 | 156 | 157 | 158 | 159 | 160 | 161 | 162 | 163 | -------------------------------------------------------------------------------- /app/.gitignore: -------------------------------------------------------------------------------- 1 | /build 2 | -------------------------------------------------------------------------------- /app/build.gradle: -------------------------------------------------------------------------------- 1 | apply plugin: 'com.android.application' 2 | 3 | android { 4 | compileSdkVersion 25 5 | buildToolsVersion "25.0.1" 6 | defaultConfig { 7 | applicationId "com.lqr" 8 | minSdkVersion 16 9 | targetSdkVersion 25 10 | versionCode 1 11 | versionName "1.0" 12 | testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner" 13 | } 14 | buildTypes { 15 | release { 16 | minifyEnabled false 17 | proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro' 18 | } 19 | } 20 | } 21 | 22 | dependencies { 23 | compile fileTree(dir: 'libs', include: ['*.jar']) 24 | androidTestCompile('com.android.support.test.espresso:espresso-core:2.2.2', { 25 | exclude group: 'com.android.support', module: 'support-annotations' 26 | }) 27 | compile 'com.android.support:appcompat-v7:25.0.1' 28 | compile project(path: ':library') 29 | testCompile 'junit:junit:4.12' 30 | } 31 | -------------------------------------------------------------------------------- /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 D:\Program Files\android-sdk-windows/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/src/androidTest/java/com/lqr/ExampleInstrumentedTest.java: -------------------------------------------------------------------------------- 1 | package com.lqr; 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("com.lqr", appContext.getPackageName()); 25 | } 26 | } 27 | -------------------------------------------------------------------------------- /app/src/main/AndroidManifest.xml: -------------------------------------------------------------------------------- 1 | 2 | 4 | 5 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | -------------------------------------------------------------------------------- /app/src/main/java/com/lqr/Demo1Activity.java: -------------------------------------------------------------------------------- 1 | package com.lqr; 2 | 3 | import android.os.Bundle; 4 | import android.support.v7.app.AppCompatActivity; 5 | import android.widget.TextView; 6 | 7 | import com.lqr.dropdownLayout.LQRDropdownLayout; 8 | 9 | import java.util.ArrayList; 10 | import java.util.LinkedHashMap; 11 | import java.util.List; 12 | import java.util.Map; 13 | 14 | /** 15 | * @创建者 CSDN_LQR 16 | * @描述 普通的用法 17 | */ 18 | public class Demo1Activity extends AppCompatActivity { 19 | private LQRDropdownLayout mDl; 20 | 21 | @Override 22 | protected void onCreate(Bundle savedInstanceState) { 23 | super.onCreate(savedInstanceState); 24 | setContentView(R.layout.activity_demo1); 25 | mDl = (LQRDropdownLayout) findViewById(R.id.dl); 26 | mDl.setCols(2); 27 | 28 | //创建内容区 29 | TextView tv = new TextView(this); 30 | tv.setText("我是内容,可以是View,也可以是ViewGroup"); 31 | 32 | //创建下拉列表数据 33 | final List> listData = new ArrayList<>(); 34 | for (int i = 0; i < mDl.getCols(); i++) { 35 | //这里使用LinkedHashMap是为了让下拉列表的条目有序 36 | Map map = new LinkedHashMap<>(); 37 | for (int j = 0; j < 6; j++) { 38 | map.put("name " + j, "value " + j); 39 | } 40 | listData.add(map); 41 | } 42 | 43 | 44 | mDl.init(tv, listData); 45 | mDl.setOnDropdownListListener(new LQRDropdownLayout.OnDropdownListListener() { 46 | @Override 47 | public void OnDropdownListSelected(int indexOfButton, int indexOfList, String textOfList, String valueOfList) { 48 | 49 | } 50 | 51 | @Override 52 | public void onDropdownListOpen() { 53 | 54 | } 55 | 56 | @Override 57 | public void onDropdownListClosed() { 58 | 59 | } 60 | }); 61 | } 62 | } 63 | -------------------------------------------------------------------------------- /app/src/main/java/com/lqr/Demo2Activity.java: -------------------------------------------------------------------------------- 1 | package com.lqr; 2 | 3 | import android.os.Bundle; 4 | import android.support.v7.app.AppCompatActivity; 5 | import android.widget.TextView; 6 | 7 | import com.lqr.dropdownLayout.LQRDropdownLayout; 8 | 9 | import java.util.ArrayList; 10 | import java.util.LinkedHashMap; 11 | import java.util.List; 12 | import java.util.Map; 13 | 14 | /** 15 | * @创建者 CSDN_LQR 16 | * @描述 可以设置为选中项不在下拉列表中显示,可以给下拉按钮文字设置前缀和后缀 17 | */ 18 | public class Demo2Activity extends AppCompatActivity { 19 | private LQRDropdownLayout mDl; 20 | 21 | @Override 22 | protected void onCreate(Bundle savedInstanceState) { 23 | super.onCreate(savedInstanceState); 24 | setContentView(R.layout.activity_demo2); 25 | mDl = (LQRDropdownLayout) findViewById(R.id.dl); 26 | mDl.setCols(2); 27 | 28 | //创建内容区 29 | TextView tv = new TextView(this); 30 | tv.setText("我是内容,可以是View,也可以是ViewGroup"); 31 | 32 | //创建下拉列表数据 33 | final List> listData = new ArrayList<>(); 34 | for (int i = 0; i < mDl.getCols(); i++) { 35 | //这里使用LinkedHashMap是为了让下拉列表的条目有序 36 | Map map = new LinkedHashMap<>(); 37 | for (int j = 0; j < 6; j++) { 38 | map.put("name " + j, "value " + j); 39 | } 40 | listData.add(map); 41 | } 42 | 43 | 44 | mDl.init(tv, listData); 45 | mDl.setOnDropdownListListener(new LQRDropdownLayout.OnDropdownListListener() { 46 | @Override 47 | public void OnDropdownListSelected(int indexOfButton, int indexOfList, String textOfList, String valueOfList) { 48 | 49 | } 50 | 51 | @Override 52 | public void onDropdownListOpen() { 53 | 54 | } 55 | 56 | @Override 57 | public void onDropdownListClosed() { 58 | 59 | } 60 | }); 61 | } 62 | } 63 | -------------------------------------------------------------------------------- /app/src/main/java/com/lqr/MainActivity.java: -------------------------------------------------------------------------------- 1 | package com.lqr; 2 | 3 | import android.content.Intent; 4 | import android.os.Bundle; 5 | import android.support.v7.app.AppCompatActivity; 6 | import android.view.View; 7 | 8 | public class MainActivity extends AppCompatActivity { 9 | 10 | 11 | @Override 12 | protected void onCreate(Bundle savedInstanceState) { 13 | super.onCreate(savedInstanceState); 14 | setContentView(R.layout.activity_main); 15 | } 16 | 17 | public void demo1(View view) { 18 | startActivity(new Intent(this, Demo1Activity.class)); 19 | } 20 | 21 | public void demo2(View view) { 22 | startActivity(new Intent(this, Demo2Activity.class)); 23 | } 24 | } 25 | -------------------------------------------------------------------------------- /app/src/main/res/layout/activity_demo1.xml: -------------------------------------------------------------------------------- 1 | 2 | 9 | 10 | 19 | 20 | -------------------------------------------------------------------------------- /app/src/main/res/layout/activity_demo2.xml: -------------------------------------------------------------------------------- 1 | 2 | 9 | 10 | 17 | 18 | -------------------------------------------------------------------------------- /app/src/main/res/layout/activity_main.xml: -------------------------------------------------------------------------------- 1 | 2 | 10 | 11 |