2
我在工具欄中使用工具欄進行材質設計。一切工作正常,但除了當涉及到更改菜單項文字顏色,我完全堅持解決方案。我也張貼應該採取的文本截圖和我在我的應用程序中使用的代碼供您參考。我嘗試了幾種替代方法,如分配如下如何更改棒棒糖和棒棒糖版本的工具欄菜單項文本顏色
<item name="android:actionMenuTextColor">@color/white</item>
<item name="android:textColor">#000</item>
但是,上述解決方案的已知適用於我。
要求截圖:
需要跳過菜單項,從黑色變爲白色。
styles.xml
<style name="ToolBarTheme" parent="@style/Theme.AppCompat.Light">
<item name="colorPrimary">@color/blue</item>
<item name="colorPrimaryDark">@color/blue</item>
<item name="windowNoTitle">true</item>
<item name="windowActionBar">false</item>
<item name="drawerArrowStyle">@style/DrawerArrowStyle</item>
<item name="android:actionMenuTextColor">@color/white</item>
<item name="android:textColor">#000</item>
</style>
toolbar.xml
<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="?attr/actionBarSize"
app:popupTheme="@style/ThemeOverlay.AppCompat.Light"
app:layout_scrollFlags="scroll|enterAlways"
android:fitsSystemWindows="true"
android:background="?attr/colorPrimary"/>
體現
<activity
android:name=".activity.HomeActivity"
android:label="@string/app_name"
android:screenOrientation="portrait"
android:configChanges="keyboard|screenLayout|orientation"
android:theme="@style/ToolBarTheme"></activity>
我真的不知道w ^在這裏我犯了錯誤。請幫幫我。在此先感謝
謝謝。它效果很好。 – Chandru
我接受你的回答 – Chandru
很高興幫助。 – Raghunandan