4

I want to change ActionBar Indicator(the left arrow) and don't want to display the logo so i setDisplayShowHomeEnabled(false) to make the logo is invisiable, and setHomeAsUpIndicator(my image) to change the indicator, but it doesn't work

Jcsoo
  • 39
  • 4
  • 2
    What does "out doesn't work" mean? What happens? – mkobit Dec 15 '14 at 06:50
  • if setDisplayShowHomeEnabled(true), i can replace the image; else setDisplayShowHomeEnabled(false), i can't replace the image..... – Jcsoo Dec 16 '14 at 01:16

2 Answers2

3

One way is to not call setDisplayShowHomeEnabled(false). Instead use findViewById() to get the home View, and directly set it to GONE.

View homeView = findViewById(android.R.id.home);
homeView.setVisibility(View.GONE);
Mike M.
  • 38,532
  • 8
  • 99
  • 95
  • When using support v7 library revision 21 it just doesn't work - `findViewById(android.R.id.home)` always returns null as I can see – sberezin Feb 07 '15 at 15:15
  • 1
    @sberezin Apologies. In reviewing my inbox, I just realized I'd not seen your message. When using that support library, you might be using the `Toolbar` class, instead of an `ActionBar`. I would direct you to [my answer here](http://stackoverflow.com/questions/28279953/get-reference-to-drawer-toggle-in-support-actionbar/28280347#28280347) for a general sense of what's happening. I hope it'll give you an idea of how to proceed in your circumstance. – Mike M. Feb 14 '15 at 02:46
0

Why don't you do this in your Manifest.xml file

android:logo=@null or android:icon=@null

Biu
  • 1,066
  • 10
  • 18