Basically, I want to make sure my UI elements (TextViews, Buttons, etc) are left aligned with the ActionBar logo. My idea was to try to find out the left spacing between the edge of the screen and the left side of the logo (shown highlighted in blue in the attached image), and use this value as the left margin for the UI elements in my Activity, but I've been unable to get this value.
So, how can I get the value of this margin? Or, is there a better way of accomplishing this?
Thanks.
Just use the standards for defining paddings as described in the Android Design documents on d.android.com. This page gives a good example of how your layout must be structured in terms of paddings between elements.
You check these answers . Custom layout for the action bar worked for me to change this padding and you can also get padding value.
remove padding around action bar left icon on Android 4.0+
Related
I'm trying to implement an Material Design like Toolbar including a search (using the support SearchView).
I run into the problem that I can't get the SearchView start at the same position (72dp from the left border) as the title. It's some dp more right than the title. How can I fix this?
I put contentInsetStart="72dp" to the toolbar for getting the title at the mentioned line, but the SearchView now starts like 100dp from the left.
I want to have it like this:
The right solution for my problem was setting app:titleMarginStart="16dp" for the android.support.v7.widget.Toolbar.
Try to override abc_dropdownitem_text_padding_left to 0dp or negative value using ref.xml. Default value is 8dp, when you add 72dp content inset this will move all content to right including their padding which contribute to those you see as 100dp.
It seems that icons and text menu items on a Toolbar take different paddings
Google doesn't seem to implement their design specification. I think icons take 12dp but text menu items take just 8dp. What's the right way to give text menu items additional padding so that they match icons' paddings?
What is the canonical approach to handling this inconsistency?
Thanks
I'm making use of Siyamed's menu item in my app.. I would like to place the menu item in the bottom center of the screen.. and when I click on it, the child items should surround the center icon. Any ideas on how to start?
I recommend you tried another implementation: ArcMenu by daCapricorn.
As the author said on Google+:
If you want to put it align the screen bottom, you can set alignparentbottom="true" in xml and compute the marginBottom (it should be negative) programmatically.
PS: I personnality ended up using ArcMenu library rather than SatelliteMenu for the same issue.
I know how to make the gradient and the logo. But I don`t know how to add all that different borders and how to add the refresh icon (that also has some custom border around it).
Instagram Action Bar:
How is that possible?
You can do it by using a horizontal LinearLayout with 2 children, the left hand column with the logo and the right hand column with the refresh button. You can create a background drawable using the Shape XML:
http://developer.android.com/guide/topics/resources/drawable-resource.html#Shape
I'd look at the provided ActionBar and ActionBarCompat. It has hooks for producing basic, as well as complex action bars.
I'd like to replicate the search bar in Contacts app > Favorites > Search (sans icon). Could someone give me a few tips?
A linear layout maybe with some top, left and bottom padding, width is fill_parent, and a weight of 1? With a button next to it with some right padding? How do I make the button look like that? Is there a parameter I can set to get the gradient background of the back? Or do I need to supply an image?
Screen shot
Check this tutorial and see the implemented code of that app in this git repo.