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

自定义spinner

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

感谢

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

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

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

……

效果图

16175718_2OGS.jpg

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

最后编辑于
©著作权归作者所有,转载或内容合作请联系作者
平台声明:文章内容(如有图片或视频亦包括在内)由作者上传并发布,文章内容仅代表作者本人观点,简书系信息发布平台,仅提供信息存储服务。