Display logo in Android 5 (Lollipop) in status bar - android

Does anybody know if it is still possible to display a logo in the action bar on Android 5? It seems that using android:logo does not work anymore. I cannot find anything in the documentation about it.

After digging around, I found an answer. In order to display the logo in holo, you need to call both of the following methods:
actionBar.setDisplayUseLogoEnabled(true);
actionBar.setDisplayHomeAsUpEnabled(true);

Related

How to disable shadow action bar (android 5.0)?

I am currently building an app that uses the material design theme as a base theme.
However the action bar has a dark shadow below the action bar.
I have tried everything I can think of, but I can't seem to get rid of it.
Here is a screen shot showing what I mean:
https://docs.google.com/file/d/0B_krkpxyd558V0p6a1NKZXFHeHc/edit?usp=docslist_api
If someone could tell me how I can get rid of it, I would much appreciate it.
Thanks
Corey :)
Shadow is created by using elevation, here's how you can disable it programmatically:
getActionBar().setElevation(0);

How to add progress bar under ActionBar (Like Google +)

I cant seem to find any good documentation on how to add a progress bar under the ActionBar like the Google+ App. Is there a built in way of doing this or do I have to programmatically add it in?

Spacing between Action bar icon and Title.

I'm using ABS for backwards compatibility. In one of my activities, I'm using Action Bar tabs which appear before custom view (in landscape) in action bar so I can't use that. So i'm using Action bar title. So in short, my question is how do I increase the spacing between the title and the icon?
I added some spacing like this:
actionBar.setTitle(" " + myTitle);
I don't think it should be done this way but I've searched a lot I couldn't find any solution for this without using custom view which I can't because I'm using AB tabs.
So if anyone else has a better (cleaner) solution, do answer. For others, this works better than anything else I tried.
Cheers!
Adding these link in Toolbar declaration in xml file.
app:contentInsetLeft="16dp"
app:contentInsetStart="16dp"
app:contentInsetEnd="16dp"
app:titleMarginStart="32dp"
Pay attention at the app prefix. This worked for me with Android 4.4.2 and Android 5.1.

Hide ActionBar, keep tabs not working in Android Kitkat

I am trying to hide action bar, but keep tabs.
I used following codes, but this is not working for Android KitKat (Tested on Nexus 5).
actionBar.setDisplayShowHomeEnabled(false);
actionBar.setDisplayShowTitleEnabled(false);
Does anyone know how to solve this issue out on Android KitKat?
ActionBar tabs are part of the ActionBar, you can't display the tabs without the ActionBar.
Instead, you have to use TabHost.
Perhaps you didn't yet try:
actionbar.hide()

Change logo that appears in Android ActionBar programatically

Is there a way to change the logo that appears in the ActionBar inside an Activity instead of listing it in the Manifest?
The reason I ask is I have an app for phones where I build a similar type of bar across the top with the launcher icon in the left corner similar to the ActionBar using an ImageView.
I also allow the user to change that image to one on their phone or on the internet. I am currently making the app work for tablets and would like to just use the ActionBar instead but can't figure out how to change the image based on the user. There is no method in the ActionBar class and I could not find a way to modify the icon or logo from the resources.
Anyone know if this is possible or could suggest something I could try?
Prior to the introduction in API 14 of the setIcon and setLogo methods that Jake mentions, you appear to be able to change the ActionBar logo by grabbing the view of android.R.id.home and setting a new drawable.
ImageView logo = (ImageView) findViewById(android.R.id.home);
logo.setImageDrawable(drawable);
API 14 introduced setIcon and setLogo methods.
As for 11 through 13 there's no easy way.
You could possibly use a custom navigation and hide the regular icon/logo by having your own layout mimic its functionality.
There is a homeLayout attribute in the action bar style which allows specifying an alternate layout resource to be used but it will always throw a ClassCastException since it is instantly cast to an internal class upon inflation (bug #21842).

Categories

Resources