4

In Holo theme adding this

 myActionBar.setDisplayHomeAsUpEnabled(true);

enter image description here

I can see the app logo (in my case mm_logo see below) in left top edge, and this logo acts as drawer toggle button

In Material the logo isn't shown

enter image description here

but if I add

myActionBar.setDisplayShowHomeEnabled(true);

the app icon is shown at the top left edge (in my case ic_launcher see below)

 <application
            android:allowBackup="true"
            android:icon="@drawable/ic_launcher"
            android:logo="@drawable/mm_logo"
            android:label="@string/app_name"
            android:theme="@style/Theme.GreenAppTheme"
            android:largeHeap="true">

If I add both these lines

myActionBar.setDisplayShowHomeEnabled(true);
myActionBar.setDisplayUseLogoEnabled(true);

The logo is shown also in Material but tend to fill the space leaved by buttons with too high left margin and doesn't act like a drawer toggle button(is a simple static image). Here an example:

enter image description here

Any idea to configure action bar to show in material design theme the logo mm_logo to act like drawer toggle without re-implement a custom ActionBar class?

NOTE: The drawer button works in material, what I want is that the drawer toggles also if the users click on the logo not only clicking directly the 3 lines drawer button

Silverstorm
  • 15,398
  • 2
  • 38
  • 52

1 Answers1

2

You can use the new support library v7 appcompat library.

The new ActionBarDrawerToggle in support v7 library is updated, which contains the menu-to-arrow animation.

I have answer a familiar question in which I mentioned how to implement this animation with support library.

Here is the link:How to implement DrawerArrowToggle from Android appcompat v7 21 library

Community
  • 1
  • 1
Yong
  • 2,943
  • 1
  • 13
  • 11
  • The drawer button works in material, what I want is that the drawer toggles also if the users click on the logo not only clicking directly the 3 lines drawer button – Silverstorm Oct 19 '14 at 13:03
  • @Silverstorm If you use Toolbar which is added in support.v7.library, you can call the function `setNavigationIcon(int resId)` to set your logo as a navigation icon, so that you can click it as you click the ActionBarDrawerToggle without a custom ActionBar.Hope this can help you. – Yong Oct 19 '14 at 14:56