I'm trying to do an application using support libraries, and I tried to add an action bar to it. The action bar works just fine, but it doesn't show the company icon. I tried specifying icon and logo, in the manifest and programatically, but still, nothing works.
In my code, I have this:
//Actionbar setup
mActionBar = getSupportActionBar();
mActionBar.setIcon(res.getDrawable(R.drawable.ic_launcher));
mActionBar.setLogo(res.getDrawable(R.drawable.ic_launcher));
mActionBar.setTitle("");
//Tabs setup
mActionBar.setNavigationMode(ActionBar.NAVIGATION_MODE_TABS);
tabConoce = mActionBar.newTab().setText(res.getString(R.string.conoce));
tabExperimenta = mActionBar.newTab().setText(res.getString(R.string.experimenta));
frgConoce = new TabConoce();
frgExperimenta = new TabExperimenta();
tabConoce.setTabListener(new GeaTabListener(frgConoce));
tabExperimenta.setTabListener(new GeaTabListener(frgExperimenta));
mActionBar.addTab(tabConoce);
mActionBar.addTab(tabExperimenta);
And in the manifest, I have this:
<application
android:icon="@drawable/ic_launcher"
android:logo="@drawable/ic_launcher"
... >
...
</application>
Please help.
This works with the native action bar on Android 5.0 to display an icon:
getActionBar().setLogo(R.drawable.ic_launcher);
getActionBar().setDisplayShowHomeEnabled(true);
getActionBar().setDisplayUseLogoEnabled(true);
Whether it works with the appcompat-v7
action bar, I cannot say, as I have not yet tried that.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With