自定義spinner
自定義spinner,使用AppCompatTextView+PopupWindow 實(shí)現(xiàn)下拉選擇的功能裁着,代碼簡(jiǎn)單繁涂,幾個(gè)類(lèi)
感謝
https://github.com/arcadefire/nice-spinner,本項(xiàng)目是對(duì)其的優(yōu)化與擴(kuò)展
1二驰、實(shí)現(xiàn)了下拉菜單與現(xiàn)實(shí)view樣式的分離扔罪,可單獨(dú)對(duì)顯示結(jié)果的textview進(jìn)行樣式的處理
2、對(duì)下拉菜單增加了分割線(xiàn)等等
……
效果圖
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