如何修复位于工具栏顶部的 Android 4.x 的 Spinner 样式 [英] How can I fix the Spinner style for Android 4.x placed on top of the Toolbar

查看:33
本文介绍了如何修复位于工具栏顶部的 Android 4.x 的 Spinner 样式的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

根据 的 <一个 href="https://github.com/google/iosched" rel="noreferrer">Google I/O 2014 应用并对其进行了调整.

布局

toolbar_spinner.xml

<线性布局xmlns:android=http://schemas.android.com/apk/res/android"android:layout_width="wrap_content";android:layout_height=match_parent"机器人:方向=垂直"><微调器android:id="@+id/toolbar_spinner";style="@style/Widget.MyApp.HeaderBar.Spinner";android:layout_width="wrap_content";android:layout_height=match_parent"/></LinearLayout>

toolbar_spinner_item_actionbar.xml

<线性布局xmlns:android=http://schemas.android.com/apk/res/android"android:layout_width=200dp"android:layout_height="wrap_content";机器人:方向=垂直"><文本视图android:id="@android:id/text1";android:layout_width="wrap_content";android:layout_height="wrap_content";android:drawablePadding="8dp"android:drawableRight="@drawable/spinner_triangle";android:fontFamily="sans-serif";android:paddingLeft="16dp"android:paddingRight=4dp"android:textColor="#ffffffff";android:textSize=18dp"android:textStyle=粗体"/></LinearLayout>

spinner_triangle drawable 可以在 此处.

toolbar_spinner_item_dropdown.xml

<线性布局xmlns:android=http://schemas.android.com/apk/res/android"android:layout_width=200dp"android:layout_height="wrap_content";机器人:方向=垂直"><文本视图android:id="@android:id/text1";android:layout_width=match_parent"android:layout_height=48dp"android:drawablePadding="8dp"android:gravity="center_vertical|start";android:paddingLeft="16dp"android:paddingRight=16dp"android:textColor="#ff333333";android:textSize="16sp"/></LinearLayout>

样式

toolbar_spinner.xml 使用以下样式.