Android微调器没有改变风格

时间:2017-07-17 13:06:41

标签: java android xml

所以我有微调器工作,它工作正常,但我不能更改活动除了activity_main.xml中的背景颜色

第一个是simple_spinner_dropdown_item.xml

<TextView xmlns:android="http://schemas.android.com/apk/res/android"
          android:id="@android:id/text1"
          style="?android:attr/spinnerDropDownItemStyle"
          android:layout_width="match_parent"
          android:layout_height="48dp"
          android:background="@color/app_primary"
          android:ellipsize="marquee"
          android:layout_centerVertical="true"
          android:singleLine="true"
          android:textColor="@color/white"
/>

第二个是simple_dropdown_item.xml

<TextView xmlns:android="http://schemas.android.com/apk/res/android"
          android:id="@android:id/text1"
          android:layout_width="match_parent"
          android:layout_height="wrap_content"
          android:textColor="@color/white"
          android:background="@color/app_primary"
          android:textSize="20sp"
          android:textStyle="normal"
 />

1 个答案:

答案 0 :(得分:0)

如果要自定义下拉列表项,则需要创建新的布局文件。我们称之为spinner_dropdown_item.xml:

Viewport

微调器声明的另一个变化:

<?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="true"
android:layout_width="match_parent"
android:layout_height="?android:attr/listPreferredItemHeight"
android:ellipsize="marquee"
android:textColor="#aa66cc"/>

试试这个,希望有所帮助