<Spinner
android:id="@+id/spinnerTextValue"
android:layout_width="wrap_content"
android:layout_height="match_parent"
android:spinnerMode="dropdown"
android:overlapAnchor="false"
android:background="@drawable/background_spinner_layout"
android:textColor="@color/colorPrimary"
android:textSize="@dimen/form_size"></Spinner>
//说明
android:spinnerMode="dropdown"
android:overlapAnchor="false"
设置下拉在下边
//
ArrayAdapter adapter = new ArrayAdapter<String>(this, R.layout.simple_spinner_item, status);
布局 adapter.setDropDownViewResource(R.layout.simple_spinner_dropdown_item);
spinner.setAdapter(adapter);
//自定义
---simple_spinner_item
<TextView xmlns:android="http://schemas.android.com/apk/res/android"
android:id="@android:id/text1"
style="?android:attr/spinnerItemStyle"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:ellipsize="marquee"
android:singleLine="true"
android:textAlignment="inherit"
android:textSize="@dimen/values_size" />
-----simple_spinner_dropdown_item
<CheckedTextView xmlns:android="http://schemas.android.com/apk/res/android"
android:id="@android:id/text1"
style="?android:attr/spinnerDropDownItemStyle"
android:singleLine="true"
android:layout_width="match_parent"
android:padding="8dp"
android:textSize="@dimen/values_size"
android:layout_height="wrap_content"
android:ellipsize="marquee"/>
网友评论