簡體   English   中英

更改后退按鈕上的顏色(在ActionBar上)

[英]Change color on back button (on ActionBar)

如何在ActionBar更改后退按鈕顏色? (從黑色到白色)。 它是這個按鈕的屏幕截圖:

在此輸入圖像描述

以及如何在ActionBar上更改微調箭頭顏色?

以下適用於ToolBar

<style name="MyTheme" parent="Theme.AppCompat">
   <item name="drawerArrowStyle">@style/MyDrawerArrowToggle</item>
</style>

<style name="MyDrawerArrowToggle" parent="Widget.AppCompat.DrawerArrowToggle">
  <item name="color">@color/your_color</item>
</style>

編輯


選項2

<style name="ToolbarThemeWhite" parent="@style/ThemeOverlay.AppCompat.ActionBar">
        <item name="colorControlNormal">@color/white</item>
        <item name="android:textColorPrimary">@color/white</item>
    </style>

將此樣式設置為工具欄

以下代碼示例為我工作

 <style name="AppTheme.AppBarOverlay" parent="ThemeOverlay.AppCompat.Dark.ActionBar" >
    <item name="android:windowContentOverlay">@null</item>
    <!--below line used to change the color of home(back) button color-->
    <item name="colorControlNormal">@color/red</item>
</style>

試試這個:

在此輸入圖像描述 !在導航中更改菜單顏色

在style.xml中:

<style name="MyMaterialTheme.Base" parent="Theme.AppCompat.Light.DarkActionBar">
    <item name="windowNoTitle">true</item>
    <item name="windowActionBar">false</item>
    <item name="colorPrimary">@color/colorPrimary</item>
    <item name="colorPrimaryDark">@color/colorPrimaryDark</item>
    <item name="colorAccent">@color/colorAccent</item>
    <item name="drawerArrowStyle">@style/DrawerArrowStyle</item>
    <item name="android:textColor">@color/colorAccent</item>


</style>

<style name="DrawerArrowStyle" parent="@style/Widget.AppCompat.DrawerArrowToggle">
    <item name="spinBars">true</item>
    <item name="color">@color/colorPrimaryDark</item>
</style>

在Mainfests.xml中:

<activity android:name=".MainActivity"
        android:theme="@style/MyMaterialTheme.Base"></activity>

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM