0xSina
0xSina

Reputation: 21553

Android ActionBar custom view hides ActionBarDrawerToggle

I have an ActionBarDrawerToggle in the ActionBar. My action bar also has a custom view on it. The draw toggle and custom view both appear on KitKat (4.4) API 19

However, on lower versions (for example 4.1 API 16), the custom view in my action bar completely obscures the drawer toggle.

Working fine on 4.4 (Google Nexus 5): enter image description here

How it looks on 4.1 (Google Nexus 4) (Notice the drawer missing on the left): enter image description here

Wondering what can I do in this situation? Has anyone encountered this problem?

(Please note: I am not using actionbar sherlock, just the default one)

Thanks!

Upvotes: 0

Views: 2006

Answers (1)

SHASHIDHAR MANCHUKONDA
SHASHIDHAR MANCHUKONDA

Reputation: 3322

it works for me

getActionBar().setBackgroundDrawable(
                new ColorDrawable(Color.parseColor("yourcolor here"))); //$NON-NLS-1$
        LayoutInflater inflator = (LayoutInflater) this
                .getSystemService(Context.LAYOUT_INFLATER_SERVICE);
        ActionBar actionBar = getActionBar();
        getActionBar().setDisplayShowCustomEnabled(true);
        actionBar.setDisplayShowTitleEnabled(false);
        // actionBar.setDisplayUseLogoEnabled(false);
        actionBar.setDisplayHomeAsUpEnabled(true);
        actionBar.setDisplayUseLogoEnabled(false);
        actionBar.setDisplayShowHomeEnabled(false);
        // getActionBar().setIcon(R.drawable.ic_navigation_drawer);
        // navigation icon on actionbar
        actionBar.setHomeButtonEnabled(true);
        actionBar.setIcon(null);
        View actionBarView = inflator.inflate(R.layout.actionbar_custom_layout, null);
        getActionBar().setCustomView(actionBarView);

Upvotes: 1

Related Questions