The Material guidelines for the modal navigation drawer states: "Modal navigation drawers block interaction with the rest of an app’s content with a scrim." This seems to preclude placing a banner ad on any page that uses a modal navigation drawer implementation that is fully compliant with the guidelines. I would like to know if there is a way in Android to bend those guidelines and leave a space at the bottom of the screen that is not covered by the scrim when the modal navigation drawer is used?
The solution here appears to cover the space designated for the ad and precludes an ad click. Limiting the scrim by wrapping the DrawerLayout in ConstraintLayout and setting the lower limit of DrawerLayout to a guideline also appears to not be possible. I used the layout shown by the Material guidelines.
Related
Fortnightly’s short top app bar: Material Design
On the scroll, the top app bar collapses to become a short top app bar, allowing more space for content. The short top app bar contains...
The short top app bar contains two elements: the navigation icon to open the navigation drawer, and the Fortnightly logo.
I found this guideline in material design io site, could anyone share your idea, how to make this using material design, not 3rd party plugin.
This is done using a MaterialShapeDrawable with a ShapeAppearanceModel. You can also check the source code for the toolbar.
I'm looking at the Material Design specification and see this bottom toolbar which looks good with the so-called End-Fab. https://material.io/design/components/app-bars-bottom.html#anatomy
I currently have a standard BottomNavigationBar with a Fab above, but I would very much like to left align the icons and move the fab down over the bar, as in the images in the link above.
Is it possible to do this and still keep the BottomNavigationBar or should I switch to the Bottom app bar (and rewrite the navigation logic)?
Update:
My question is not about how to align the fab, but rather how to incorporate it the same way as with the Bottom toolbar as in the images in the link above.
I'm wondering if I should combine the material design Bottom Navigation and the Navigation Drawer.
As is understand there is always one item active in the Bottom Navigation Bar, but what if I choose to navigate to a page using the Navigation Drawer menu? How do I preserve navigation consistency.? The Bottom Navigation item will still be active even if I navigated to a different activity/fragment.
I was thinking about setting all Bottom Navigation items to inactive in case a user navigates using the Navigation Drawer.
Unfortunately, the lib I'm using (https://github.com/pocheshire/BottomNavigationBar) doesn't support this.
How does the Bottom Nav Bar coexist with the Navigation Drawer? What am I missing here?
Looking at the design guidelines, it's pretty clear that the navigation drawer is at a higher z-level (hence higher hierarchy). Think of bottom navigation as essentially a replacement for tab layouts. You can look at the Google Photos application as an example.
As of Android L, we have a Toolbar instead of the ActionBar although its usages seems the same. They even made back compatibility for Toolbar via support library.
What was the reason they replaced ActionBar with a Toolbar?
Toolbar was added because UIs have evolved past the limitations of the ActionBar. The main difference is that the Toolbar can be decoupled from an Activity's opaque window decor and placed in your custom layout somewhere. From there, you have the freedom to do some more interesting things with the Toolbar. One common example is growing or shrinking the height based on scrolling.
From the Toolbar Documentation.
A Toolbar is a generalization of action bars for use within
application layouts. While an action bar is traditionally part of an
Activity's opaque window decor controlled by the framework, a Toolbar
may be placed at any arbitrary level of nesting within a view
hierarchy. An application may choose to designate a Toolbar as the
action bar for an Activity using the setActionBar() method.
Toolbar supports a more focused feature set than ActionBar. From start
to end, a toolbar may contain a combination of the following optional
elements:
A navigation button. This may be an Up arrow, navigation menu toggle, close, collapse, done or another glyph of the app's choosing.
This button should always be used to access other navigational
destinations within the container of the Toolbar and its signified
content or otherwise leave the current context signified by the
Toolbar. The navigation button is vertically aligned within the
Toolbar's minimum height, if set.
A branded logo image. This may extend to the height of the bar and can be arbitrarily wide.
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.
One or more custom views. The application may add arbitrary child views to the Toolbar. They will appear at this position within the
layout. If a child view's Toolbar.LayoutParams indicates a Gravity
value of CENTER_HORIZONTAL the view will attempt to center within the
available space remaining in the Toolbar after all other elements have
been measured.
An action menu. The menu of actions will pin to the end of the Toolbar offering a few frequent, important or typical actions along
with an optional overflow menu for additional actions. Action buttons
are vertically aligned within the Toolbar's minimum height, if set.
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.
Google just posted in their blog a post discussing best practices for implementing the material design. It says:
If the app uses a navigation drawer, it follows the newer material design interactions and styling (Figure 7). The drawer appears in front of the app bar. It also appears semitransparent behind the status bar.
But, if you look at how it is implemented in apps like Google Play Store and Inbox by Gmail, the navigation drawer is located below the Action Bar (Toolbar).
However, apps like Play Newsstand and Pushbullet use their drawer above the toolbar, as recommended.
So, which one should I use?
One side note, if I should place the drawer above the toolbar, why did Google implement the animation in the hamburger icon at all(ActionBarDrawerToggle)?
You should use the version from the Material Specs and display your left drawer over the bar.
The width of the NavigationDrawer on Inbox is also incorrect:
The width of the side nav is equal to the width of the screen minus the height of the action bar, or in this case 56dp from the right edge of the screen.
Mobile: Width = screen width - app bar height
Desktop: Max width for the left nav is 400dp. The right nav can vary depending on content.
The animation also shows when you pull out the right drawer, which should be displayed below the drawer. Further more, your drawer can be (semi-)translucent.