[英]AppCompat v21 Dark ToolBar style
我希望我的ToolBar可以作為ActionBar使用,我希望它看起來像一個帶有暗動作條的淺色主題。 我似乎無法找到合適的組合來做到這一點。
這就是我在styles.xml中所擁有的
<style name="Theme.MyTheme" parent="Theme.AppCompat.Light.DarkActionBar">
<item name="windowActionBar">false</item>
<item name="colorPrimary">@color/my_awesome_color</item>
<item name="android:textColorPrimary">@color/my_awesome_text_color</item>
<item name="colorPrimaryDark">@color/my_awesome_darker_color</item>
<item name="colorAccent">@color/accent</item>
</style>
和我的工具欄
<android.support.v7.widget.Toolbar
android:id="@+id/my_awesome_toolbar"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:background="?attr/colorPrimary"
android:minHeight="?attr/actionBarSize" />
目前我明白了
我想要的是菜單項也是白色的
是否有一個優雅的解決方案或我必須為每個工具欄的項目選擇自定義樣式? 似乎應該有。
您可以在工具欄上使用以下主題使其顯示為“黑暗”。 第一部分app:theme
主題工具欄上的文本顏色等等。 app:popupTheme
用於設置溢出菜單指示器的樣式。
<android.support.v7.widget.Toolbar
android:layout_height="wrap_content"
android:layout_width="match_parent"
android:minHeight="@dimen/triple_height_toolbar"
app:theme="@style/ThemeOverlay.AppCompat.Dark.ActionBar"
app:popupTheme="@style/ThemeOverlay.AppCompat.Light" />
我確定有點晚了,但要在你的主題中添加:
<item name="android:textColorSecondary">my_awesome_text_color</item>
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.