网上看了两篇文章,现自己总结如下。
针对spinner弹出框换行或者自定义弹出框文字格式。
1. 将系统自定义的simple_spinner_dropdown_item.xml 文件copy下来,进行改造。
将android:singleLine="false"属性,true更改为false.
<?xml version="1.0" encoding="utf-8"?>
<CheckedTextView xmlns:android="http://schemas.android.com/apk/res/android"
android:id="@android:id/text1"
style="?android:attr/spinnerDropDownItemStyle"
android:singleLine="false"
android:layout_width="match_parent"
android:layout_height="50dp"
android:ellipsize="marquee"
android:textAlignment="inherit"/>
需要注意的是 simple_spinner_dropdown_item.xml文件中 android:layout_height="?android:attr/dropdownListPreferredItemHeight"属性是私有属性。
自己重新定义个高度。