Friday, 19 June 2015

Android Actionbar Logo




getSupportActionBar().setLogo(R.mipmap.ic_launcher);
            getSupportActionBar().setTitle("asdfasdfasdfs");
//            getSupportActionBar().setDisplayUseLogoEnabled(true);//            getSupportActionBar().setIcon(R.drawable.tasking_icon_64);            getSupportActionBar().setDisplayOptions(ActionBar.DISPLAY_SHOW_HOME | ActionBar.DISPLAY_USE_LOGO | ActionBar.DISPLAY_SHOW_TITLE);



getSupportActionBar().setDisplayUseLogoEnabled(true); most of people online say this code with android:logo="@drawable/nav_background" on manifest.xml will solve the problem. but this is useless!

getSupportActionBar().setDisplayOptions(ActionBar.DISPLAY_SHOW_HOME | ActionBar.DISPLAY_USE_LOGO | ActionBar.DISPLAY_SHOW_TITLE); this code solved the problem.
getSupportActionBar().setLogo(R.mipmap.ic_launcher);
getSupportActionBar().setIcon(R.mipmap.ic_launcher);

this two function calls can give you same result.

No comments:

Post a comment