Spinner 是个挺好用的控件,但是平时没注意到。
最近有用到这个控件,来写一下笔记
首先在布局上放上 一个Spinner控件
activity_main:
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools"
android:orientation="vertical"
android:layout_width="match_parent"
android:layout_height="match_parent"
tools:context=".MainActivity">
<Spinner
android:id="@+id/spinner1"
android:background="@null"
android:layout_width="match_parent"
android:layout_height="50dp"
android:gravity=&