簡體   English   中英

ActionBar中的HamBurger圖標

[英]HamBurger Icon in ActionBar

我想在操作欄的右側使用一個漢堡包圖標。 但是它正在顯示箭頭標志。 我包括了Library AppCompatV7,並從Activity擴展了我的課程。 有人可以提供解決方案嗎? 我已經嘗試了許多解決方案,但是都沒有用。

打開Android Manifest,檢查您使用的主題。 我在主要活動中使用AppTheme

<application
        android:allowBackup="true"
        android:icon="@mipmap/ic_launcher"
        android:label="@string/app_name"
        android:supportsRtl="true"
        android:theme="@style/AppTheme">
        <activity
            android:name=".FrontPageActivity"
            android:label="@string/app_name">
        </activity>

2)打開res / values / styles,確保您的主題包含屬性“ drawerArrowStyle”,然后為其創建新樣式以將“ spinBars”的值更改為true。

<style name="AppTheme" parent="Theme.AppCompat.Light.DarkActionBar">
        <!-- Customize your theme here. -->
        <item name="colorPrimary">@color/colorPrimary</item>
        <item name="colorPrimaryDark">@color/colorPrimaryDark</item>
        <item name="colorAccent">@color/colorAccent</item>
        <item name="drawerArrowStyle">@style/DrawerArrowStyle</item>
    </style>

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

...花了我一段時間才將其拼湊在一起。

暫無
暫無

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

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