My actionbar does not use an icon or a title, this makes the click area of the "up" button very small. How can I have a larger click area without a title and icon in the actionbar?
You can put an image where the app icon would be. Just make a transparent image to the width and height for each drawable size you need and put it in the drawable folder, call the image logo (#drawable/logo). You then need to tell the activity to use the logo, it's not hard and these links should help.
http://developer.android.com/guide/topics/ui/actionbar.html
http://developer.android.com/guide/topics/manifest/application-element.html#logo
One way to do it would be to set a custom icon for the "up" button in your app theme as so:
<item name="android:homeAsUpIndicator">#drawable/your_drawable</item>
Related
For my app I want to have the same behavior of the icon in the toolbar as seen in the picture. My guess is they made a white square around the icon and then set a paddingTop on the icon or maybe resized the icon?
How can I do this to only the icon? I already made some mods in my style.xml to the text in the toolbar.
Would this be the right place?
As the title says I would like to programmatically change the icon of the crosshair in the setMyLocationButtonEnabled(true) button. If this is not possible, I would like to know how to tint the icon if possible. If it's unclear which button I'm talking about here is a photo.
Edit 1: While the link provided by Zainal Fahrudin does address how to move the button, I am still unable to tint the icon itself without tinting the whole button or replace the icon. Below is what I have now. You can see the black icon on top of the blue icon in the background.
My requirement is to make Circular Icon to ActionBar. I used custom view to display circular image(you can see in the screenshot.) I want to use Home icon(In this case, green android icon) as a circular image. How can I make Home icon as a Circular Image??
Note: In my case I'm downloading images from Server and setting it to ActionBar using setLogo() or setIcon() method.
Make the image default logo of your application.
Change it in the manifest file or the drawable folder.
Action bar logo is mostly your application logo by default. So either Change your application logo to circular or whatever. If you want to change the app icon (logo). Use setLogo(int) or setLogo(Drawable) method of ActionBar. Don't forget to call setDisplayUseLogoEnabled(true)
I am using ActionBar Sherlock library. So, to change the default home button. I did this:
<style name="Theme.mTheme" parent="android:Theme.Sherlock.Light.DarkActionBar">
<item name="android:homeAsUpIndicator">#drawable/custom_home</item>
</style>
which didn't work
So, i added this too:
<item name="homeAsUpIndicator">#drawable/custom_home</item>
now its working. I am having this custom home icon/button on every ActionBar. But in 1 of my Activities i have this in code:
actionBar.setIcon(R.drawable.options_holo_dark);
When i am in that Activity, I can see the icon which i set programatically ie.., options_holo_dark. The 1 which i set in Theme ie.., custom_home is not visible. But the Icon has moved to the Right as if its giving space on the left to the icon i set in theme(though not visible).
This is what i am getting now:
So, how can i avoid that empty space on the left side of the Home Icon?
Thank You
Theme item android:homeAsUpIndicator (and homeAsUpIndicator for ActionBarSherlock) sets drawable for the up icon - that's the little arrow pointing to left that is displayed next to the app icon when you have called setDisplayHomeAsUpEnabled(true) on the action bar.
The size of the up drawable defines the left margin for the app icon (logo). By default its dimensions are 16dp x 16dp. If you put there wider drawable the gap between edge of the screen and the app icon would be wider even though the up icon is not displayed at the moment.
If you want to change the app icon (logo). Use setLogo(int) or setLogo(Drawable) method of ActionBar. Don't forget to call setDisplayUseLogoEnabled(true) too - this method toggles between displaying app icon and custom logo. Also you can define the logo in manifest in attribute android:logo of <application> and <activity> tags and set in theme that you want to use logo instead of app icon in the action bar.
I have a tablet layout using ABS.
The Home (app) icon is displayed and my 4 tabs are shown to the right of it.
I'd like to insert an image (for advertising) inbetween the icon and tabs.
Does anybody know if it can be done?
Thanks in advance.
You can't insert an image between the icon and the tabs, but you could:
A. Use a logo drawable which has the icon and ad in it -- then add this by setting the android:logo attribute on your application or activity to your logo drawable.
or
B. Use a custom view and set this on the ActionBar with setCustomView(View view).