【发布时间】:2015-06-24 14:27:31
【问题描述】:
在 KitKat 中,我在受支持的库工具栏中有一个样式选项菜单,定义如下
<android.support.v7.widget.Toolbar
xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
android:id="@+id/toolbar"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:gravity="center"
android:background="?attr/colorPrimary"
app:theme="@style/ToolbarText"
app:popupTheme="@style/optionMenu"
/>
optionMenu 样式在哪里
<style name="optionMenu">
<item name="android:textColor">@color/menu_text</item>
<item name="android:background">@color/menu_background</item>
</style>
它按预期工作,但是当我按下菜单项时,它不会在所有可用空间中采用“默认灰色”颜色,而仅在菜单元素周围的边缘上,其背景保持样式中定义的颜色。我的目标不是改变 onpressed 事件的样式,我只希望文本背后的背景在按下时看起来像整个矩形按钮
我哪里错了?
【问题讨论】:
标签: android onclick styles toolbar optionmenu