Shaun
Shaun

Reputation: 35

How to remove the android actionbar icon in xamarin?

I am trying to remove the android actionbar icon in a Xamarin android project.

I have tried setting the icon as transparent and excluding the icon from the manifest. I have also tried changing the icon size to try and hide it and replacing it with a blank icon. Problem is that this also makes the icon in the launcher menu screen blank.

any suggestions would help

Thanks

Upvotes: 2

Views: 2974

Answers (4)

Vukzrito
Vukzrito

Reputation: 36

Try to use the below code, it worked perfectly for me

ActionBar.SetIcon(null);

Upvotes: 1

kjellberg
kjellberg

Reputation: 189

I've got this solved by adding this code into my Android MainActivity class:

ActionBar.SetIcon(Android.Resource.Color.Transparent);

Upvotes: 1

Harry Mad
Harry Mad

Reputation: 498

For a particular activity try this...

getActionBar().setIcon(
   new ColorDrawable(getResources().getColor(android.R.color.transparent)));

Upvotes: 1

Jason
Jason

Reputation: 89102

in your MainActivity.cs, try this

    // hide app icon in Android action/nav bar
    ActionBar.SetIcon(my_app_name.Resource.Color.transparent);

Upvotes: 1

Related Questions