您的位置:首页 > 移动开发

android自定义spinner,使用AppCompatTextView+PopupWindow 实现下拉选择的功能

2018-01-16 00:00 1091 查看
摘要: 自定义spinner,使用AppCompatTextView+PopupWindow 实现下拉选择的功能,代码简单,几个类

自定义spinner

自定义spinner,使用AppCompatTextView+PopupWindow 实现下拉选择的功能,代码简单,几个类

感谢

https://github.com/arcadefire/nice-spinner,本项目是对其的优化与扩展

1、实现了下拉菜单与现实view样式的分离,可单独对显示结果的textview进行样式的处理

2、对下拉菜单增加了分割线等等

……

效果图





apk下载链接: https://github.com/supertaohaili/spinner/blob/master/app-debug.apk

github:https://github.com/supertaohaili/Spinner

使用

allprojects {
repositories {
...
maven { url 'https://jitpack.io' }
}
}

dependencies {
compile 'com.github.supertaohaili:Spinner:1.0.0'
}

示例代码:
<org.angmarch.views.NiceSpinner
android:id="@+id/spinner2"
android:layout_width="200dp"
android:layout_height="40dp"
android:layout_gravity="center_horizontal"
android:layout_marginTop="25dp"
android:background="@drawable/shape"
android:gravity="center"
app:dropDownListPaddingBottom="35dp" />

NiceSpinner niceSpinner2 = (NiceSpinner) findViewById(R.id.spinner2);
List<String> dataset2 = new LinkedList<>(Arrays.asList("10","11","12","13","14","15","16","17","18","19"));
niceSpinner2.attachDataSource(dataset2);


Known Issues

If you have any questions/queries/Bugs/Hugs please mail @ taohailili@gmail.com
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
相关文章推荐