I'm trying to replicate the breadcrumbs example:
I've gotten as far as adding TextViews to the Toolbar but can't fully replicate the font/size/color of the Toolbar's style and can't get the breadcrumbs to float off the screen to the left.
You will need to create your own Breadcrumb View and add it in your Toolbar. Maybe based on the now deprecated FragmentBreadCrumbs view.
To get the breadcrumbs to float off the screen you can use negative margin.
Related
I added this translucent gradient background to a Toolbar so buttons are noticeable on any background, but I wonder how to make a shadow just under the button itself instead of what I did?
Thank You
EDIT
So I realized the easiest way to achieve that is by setting a Drawable Resources.
getSupportActionBar().setHomeAsUpIndicator(R.drawable.ic_home);
and
<style name="AppTheme" parent="parent_theme">
<item name="actionModeShareDrawable">#drawable/ic_share</item>
</style>
I downloaded Material Vector assets, added shadow in Adobe Illustrator, imported it to PNG. But the Android Studio's Image Asset/Action Bar and Tab Icons mess up with it I didn't get why - it removed the shadow and colors went different even with Custom 'Theme' so I did different dpi image sizes by myself and that's what I got. That's quite what I wanted
http://imgur.com/vnR98H5
Well, I don't know how to do it with simple button, if you could change Button with FloatingActionButton you may use elevation for making a shadow.
Floating Action Button (FAB) is simply a circle button with some drop shadow that unbelieveably could change the world of design. No
surprise why it becomes a signature of Material Design. So let's start
with this thing. Add FAB in layout file with FloatingActionButton and wrap it with FrameLayout since it needs some parent to make it aligned at bottom right position of the screen.
and
The shadow depth is automatically set to the best practices one, 6dp
at idle state and 12dp at pressed state. Anyway you are allowed to
override these values by defining app:elevation for idle state's
shadow depth and app:pressedTranslationZ for press state's.
From: http://inthecheesefactory.com/blog/android-design-support-library-codelab/en
Of course, you can customize by adding your icon. I'm pretty sure, that play icon as you have on button is in Material Design library.
You can also grab it here: https://design.google.com/icons/
To resume, I advice you learn something more about FloatingActionButton, which alows you to add some nice effect like elevation/shadow and others good things from Material library.
Hope it make your development easier and your app more beautiful.
How can we create a collapsing toolbar layout like Yahoo News Digest application ?
Have you tried adding app:behavior_overlapTop="50dp" to your scrolling view? (This is the default behavior. Code can be found here.)
Apparently, it should support that attribute to make the scrolling view overlap your app bar.
Start by implementing the square collapsing toolbar as you can find in many other guides and then set that parameter.
If that does not work, you could write your own Behavior I guess, inspiring from the one I linked you (which is the default AppBarLayout behavior that allow the coordinator layout to collapse the top part.
To make the image not square you need to use a semi-transparent image or edit it by code.
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.
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+
I have a similar problem as found on this specific question.
I'm using a Toolbar from the v7 support library, and a custom layout. If I have no options menu, I have a result similar to what OP has on the question linked above:
However if I have an options menu, it shifts the toolbar a little bit to the left (start). I would like to have it over the toolbar.
Is it possible? The only way I could hack it is by adding a negative right (end) margin to the toolbar layout, however this moves the menu outside of the screen…
Initially, the whole Toolbar contained several views, so they had to share the width with the action menu.
Now instead I wrapped the Toolbar and the other views in a container (a FrameLayout), so that they overlap without sharing the width. I just need to be careful with the margin at the top so that the other views don't overlap with action icons.