I'm using ActionBar. I want to add splitter between icon and title: For example like here:
Nothing from these answers helped me:
Android actionbar sherlok doesn't show divider
ActionBar Divider Styling
ActionBar MenuItem Divider
I've tried to apply style to ActionBar but Eclipse shows this:
android:showDividers requires API level 11 (current min is 9)
What should I do?
the easiest way is to add divider logo. If later you want it is not displayed click, just make its selector and put a logo without the divider for statepressed but with the same dimensions.
Related
In the below image you can see that there is no ActionBar and StatusBar in the preview of any XML layout file, if anyone is facing the same issue and has solution please post it.
I faced the same issue, and got this:
No ActionBar visible
Change a setting for Show Layout Decorations (By Default it is unchecked, just check it and ActionBar will be there)
Visible ActionBar
Select the theme from above which have action bar by clicking where AppTheme is written in top pane of preview window.
I try make google maps with listview app in material design. But part controls from google maps are under statusbar. I try add to layout top margin/padding, but then status bar is grey.
That same problem is with ListView, part first select from list is under statusbar.
How resove this problem?
Have you tried to set primarycolor and color accent in your main style theme?
Add this tag to your view
android:fitsSystemWindows="true"
I am trying to custom our home as up indicator on our Android ActionBar. I have change the icon and padding using theme style.
<item name="android:homeAsUpIndicator">#drawable/fb_back</item>
While this make the function
getActionBar().setDisplayHomeAsUpEnabled(false);
become useless. Because in some situation I want to hide the up arrow icon. However calling this leaves large space left of the home button. I am working on sdk 16, so I cannot dynamically set the homeAsUp indicator using
getActionBar().setHomeAsUpIndicator
Some one know a better solution to do this?
After update sdk to 21 version logo doesn't display. I display logo using following code:
actionBar.setDisplayShowHomeEnabled(true);
actionBar.setDisplayHomeAsUpEnabled(true);
actionBar.setIcon(R.drawable.ic_launcher);
The code looks:
http://i.stack.imgur.com/fAWIx.png
This code:
actionBar.setDisplayShowHomeEnabled(true);
actionBar.setIcon(R.drawable.ic_launcher);
Looks:
http://i.stack.imgur.com/hkYqa.png
This code:
actionBar.setDisplayHomeAsUpEnabled(true);
Looks:
http://i.stack.imgur.com/Ssw2A.png
My logo doesn't display as back button.
How me make old style as here? http://i.stack.imgur.com/BKOz4.png
Note: Sorry, I didn't notice similar questions. =(
Per the Toolbar documentation:
A title and subtitle. The title should be a signpost for the Toolbar's current position in the navigation hierarchy and the content contained there. The subtitle, if present should indicate any extended information about the current content. If an app uses a logo image it should strongly consider omitting a title and subtitle.
In modern Android UIs developers should lean more on a visually distinct color scheme for toolbars than on their application icon. The use of application icon plus title as a standard layout is discouraged on API 21 devices and newer.
However, if you want an application icon, setLogo() is indeed the correct method.
Here's what worked for me if using an icon
actionBar.setIcon(R.drawable.ic_app_icon);
actionBar.setDisplayShowHomeEnabled(true);
Or, if you want a wider logo
actionBar.setLogo(R.drawable.ic_app_logo);
actionBar.setDisplayShowHomeEnabled(true);
actionBar.setDisplayUseLogoEnabled(true);
I need to display a separator between the logo and text on the action bar. Is it possible to set this via styles?
P.S: My minSdk is 14, so I use system Holo elements.
I am not sure you can achieve this with the style. Generally the dividers are made for the MenuItem. A simplest way to do it, it's to add manually your divider inside your icon app and keep the width unchanged.