Clickable setIcon()/setLogo() in default action bar - android

I have default action bar with home buttom, logo/icon, title
I need make logo/icon (not home buttom) or title clickable (clickListener)
How to make it in default action bar?

Related

How can I center a menu item in an action bar?

How can I center a menu item in an action bar? I am using an image icon in action bar as menu but it appears at the right side of the action bar and I want to center it. Is it possible in android ?
This can be done using custom views in actionbar. In native actionbar view you can't set alignment of menu items. Check here another SO post for custom action bar

How to stop Android action bar logo and title being transparent

I'm using the compat library to add an action bar to an app. I have set a custom theme which extends Theme.AppCompat and set a background for the action bar and a background for the application. However the action bar icon and title backgrounds seems to be transparent which means the app background is visible through the action bar as you can see below. Any ideas?
Thanks

Hide Action Bar while showing Split Action Bar

How can I hide the top Action Bar but show the Split Action Bar using ActionBarSherlock. I would like to have Tabs at the top instead like this:
The Android developer site states the following to hide the action bar but keep the split action bar:
If you'd like to hide the main action bar at the top, because you're
using the built-in navigation tabs along with the split action bar,
call setDisplayShowHomeEnabled(false) to disable the application icon
in the action bar. In this case, there's now nothing left in the main
action bar, so it disappears and all that’s left are the navigation
tabs at the top and the action items at the bottom, as shown by the
second device in figure 3.
https://developer.android.com/guide/practices/tablets-and-handsets.html#SplitActionBar
In my SherlockFragmentActivity I call the following, however only the app icon and title disappear and the action bar stays like this:
//Hide action bar
getSupportActionBar().setDisplayShowTitleEnabled(false);
getSupportActionBar().setDisplayShowHomeEnabled(false);
Calling getSupportActionBar().hide() hides the action bar but also hides the split action bar.
The tabs only roll up into the top action bar if you are using the Tabs provided by ABS. You're not using ViewPager/ViewPagerIndicator for the tabs by any chance are you? (I have this issue currently)

Android: Hide title bar while displaying split action bar in NarrowMode?

Is there a way to hide the top title bar in actionbarsherlock while keeping the split action bar visible?

android : customized action when home logo in action bar si clicked

i changed the logo to an action icon and i want to perform an action when the logo is clicked.
How can i customize the action when the home logo in action bar is clicked?
thank you
In onOptionsItemSelected() of your activity, watch for an ID of android.R.id.home -- that will be when the home icon/logo is pressed. You can then perform whatever action makes sense (e.g., move to your app's main screen).

Categories

Resources