Material-Spinner
介绍:
一个Material的Spinner。
运行效果:
使用说明:
把spinner添加进layout xml:
<com.jaredrummler.materialspinner.MaterialSpinner
android:id="@+id/spinner"
android:layout_width="match_parent"
android:layout_height="wrap_content"/>
把items添加进spinner并监听点击:
MaterialSpinner spinner = (MaterialSpinner) findViewById(R.id.spinner);
spinner.setItems("Ice Cream Sandwich", "Jelly Bean", "KitKat", "Lollipop", "Marshmallow");
spinner.setOnItemSelectedListener(new MaterialSpinner.OnItemSelectedListener<String>() {
@Override public void onItemSelected(MaterialSpinner view, int position, long id, String item) {
Snackbar.make(view, "Clicked " + item, Snackbar.LENGTH_LONG).show();
}
});
你可以为自定义view添加属性。可用的属性:
name | type | info |
---|---|---|
ms_arrow_tint | color | sets the color on the drop-down arrow |
ms_hide_arrow | boolean | set to true to hide the arrow drawable |
ms_background_color | color | set the background color for the spinner and drop-down |
ms_text_color | color | set the text color |
下载
下载 最新的AAR 或者用Gradle:
compile 'com.jaredrummler:material-spinner:1.0.4'
或者 Maven:
<dependency>
<groupId>com.jaredrummler</groupId>
<artifactId>material-spinner</artifactId>
<version>1.0.4</version>
<type>aar</type>
</dependency>
感谢
本library基于Angelo Marchesin的 Nice Spinner 。
已下载
0