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

自定义spinner

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

感谢

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

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

二、对下拉菜单增长了分割线等等app

……maven

效果图

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

github:https://github.com/supertaohaili/Spinnerurl

使用

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.comspa

相关文章
相关标签/搜索