• Guest
HabraHabr
  • Main
  • Users

  • Development
    • Programming
    • Information Security
    • Website development
    • JavaScript
    • Game development
    • Open source
    • Developed for Android
    • Machine learning
    • Abnormal programming
    • Java
    • Python
    • Development of mobile applications
    • Analysis and design of systems
    • .NET
    • Mathematics
    • Algorithms
    • C#
    • System Programming
    • C++
    • C
    • Go
    • PHP
    • Reverse engineering
    • Assembler
    • Development under Linux
    • Big Data
    • Rust
    • Cryptography
    • Entertaining problems
    • Testing of IT systems
    • Testing Web Services
    • HTML
    • Programming microcontrollers
    • API
    • High performance
    • Developed for iOS
    • CSS
    • Industrial Programming
    • Development under Windows
    • Image processing
    • Compilers
    • FPGA
    • Professional literature
    • OpenStreetMap
    • Google Chrome
    • Data Mining
    • PostgreSQL
    • Development of robotics
    • Visualization of data
    • Angular
    • ReactJS
    • Search technologies
    • Debugging
    • Test mobile applications
    • Browsers
    • Designing and refactoring
    • IT Standards
    • Solidity
    • Node.JS
    • Git
    • LaTeX
    • SQL
    • Haskell
    • Unreal Engine
    • Unity3D
    • Development for the Internet of things
    • Functional Programming
    • Amazon Web Services
    • Google Cloud Platform
    • Development under AR and VR
    • Assembly systems
    • Version control systems
    • Kotlin
    • R
    • CAD/CAM
    • Customer Optimization
    • Development of communication systems
    • Microsoft Azure
    • Perfect code
    • Atlassian
    • Visual Studio
    • NoSQL
    • Yii
    • Mono и Moonlight
    • Parallel Programming
    • Asterisk
    • Yandex API
    • WordPress
    • Sports programming
    • Lua
    • Microsoft SQL Server
    • Payment systems
    • TypeScript
    • Scala
    • Google API
    • Development of data transmission systems
    • XML
    • Regular expressions
    • Development under Tizen
    • Swift
    • MySQL
    • Geoinformation services
    • Global Positioning Systems
    • Qt
    • Dart
    • Django
    • Development for Office 365
    • Erlang/OTP
    • GPGPU
    • Eclipse
    • Maps API
    • Testing games
    • Browser Extensions
    • 1C-Bitrix
    • Development under e-commerce
    • Xamarin
    • Xcode
    • Development under Windows Phone
    • Semantics
    • CMS
    • VueJS
    • GitHub
    • Open data
    • Sphinx
    • Ruby on Rails
    • Ruby
    • Symfony
    • Drupal
    • Messaging Systems
    • CTF
    • SaaS / S+S
    • SharePoint
    • jQuery
    • Puppet
    • Firefox
    • Elm
    • MODX
    • Billing systems
    • Graphical shells
    • Kodobred
    • MongoDB
    • SCADA
    • Hadoop
    • Gradle
    • Clojure
    • F#
    • CoffeeScript
    • Matlab
    • Phalcon
    • Development under Sailfish OS
    • Magento
    • Elixir/Phoenix
    • Microsoft Edge
    • Layout of letters
    • Development for OS X
    • Forth
    • Smalltalk
    • Julia
    • Laravel
    • WebGL
    • Meteor.JS
    • Firebird/Interbase
    • SQLite
    • D
    • Mesh-networks
    • I2P
    • Derby.js
    • Emacs
    • Development under Bada
    • Mercurial
    • UML Design
    • Objective C
    • Fortran
    • Cocoa
    • Cobol
    • Apache Flex
    • Action Script
    • Joomla
    • IIS
    • Twitter API
    • Vkontakte API
    • Facebook API
    • Microsoft Access
    • PDF
    • Prolog
    • GTK+
    • LabVIEW
    • Brainfuck
    • Cubrid
    • Canvas
    • Doctrine ORM
    • Google App Engine
    • Twisted
    • XSLT
    • TDD
    • Small Basic
    • Kohana
    • Development for Java ME
    • LiveStreet
    • MooTools
    • Adobe Flash
    • GreaseMonkey
    • INFOLUST
    • Groovy & Grails
    • Lisp
    • Delphi
    • Zend Framework
    • ExtJS / Sencha Library
    • Internet Explorer
    • CodeIgniter
    • Silverlight
    • Google Web Toolkit
    • CakePHP
    • Safari
    • Opera
    • Microformats
    • Ajax
    • VIM
  • Administration
    • System administration
    • IT Infrastructure
    • *nix
    • Network technologies
    • DevOps
    • Server Administration
    • Cloud computing
    • Configuring Linux
    • Wireless technologies
    • Virtualization
    • Hosting
    • Data storage
    • Decentralized networks
    • Database Administration
    • Data Warehousing
    • Communication standards
    • PowerShell
    • Backup
    • Cisco
    • Nginx
    • Antivirus protection
    • DNS
    • Server Optimization
    • Data recovery
    • Apache
    • Spam and antispam
    • Data Compression
    • SAN
    • IPv6
    • Fidonet
    • IPTV
    • Shells
    • Administering domain names
  • Design
    • Interfaces
    • Web design
    • Working with sound
    • Usability
    • Graphic design
    • Design Games
    • Mobile App Design
    • Working with 3D-graphics
    • Typography
    • Working with video
    • Work with vector graphics
    • Accessibility
    • Prototyping
    • CGI (graphics)
    • Computer Animation
    • Working with icons
  • Control
    • Careers in the IT industry
    • Project management
    • Development Management
    • Personnel Management
    • Product Management
    • Start-up development
    • Managing the community
    • Service Desk
    • GTD
    • IT Terminology
    • Agile
    • Business Models
    • Legislation and IT-business
    • Sales management
    • CRM-systems
    • Product localization
    • ECM / EDS
    • Freelance
    • Venture investments
    • ERP-systems
    • Help Desk Software
    • Media management
    • Patenting
    • E-commerce management
    • Creative Commons
  • Marketing
    • Conferences
    • Promotion of games
    • Internet Marketing
    • Search Engine Optimization
    • Web Analytics
    • Monetize Web services
    • Content marketing
    • Monetization of IT systems
    • Monetize mobile apps
    • Mobile App Analytics
    • Growth Hacking
    • Branding
    • Monetize Games
    • Display ads
    • Contextual advertising
    • Increase Conversion Rate
  • Sundry
    • Reading room
    • Educational process in IT
    • Research and forecasts in IT
    • Finance in IT
    • Hakatonas
    • IT emigration
    • Education abroad
    • Lumber room
    • I'm on my way

Implementation of BottomAppBar. Part 3: Behaviors for Android

[img]https://drive.google.com/uc?id=1A5NqD41YVdm24UtSUV-ia8TNkp6l63PE[/img]
 
BottomAppBar - this is one of the new Android Material components that were presented on Google I /O 2018 . By moving the Navigation Drawer and the application menu to the bottom of the screen, BottomAppBar radically changes the look and feel of Android applications.
 
In first and second parts of our series of articles about BottomAppBar we got acquainted with BottomAppBar and discussed its attributes. We also explained how to implement the Navigation Drawer and application menus within BottomAppBar.
for the BottomAppBar .
 
Layout
 
The first one describes the BottomAppBar layout. Here is that is proposed :
 
For different in the meaning screens of the application, you can change the layout and set of menu items in BottomAppBar. For example, you can display more or fewer menu items depending on what is best for a particular screen.
[img]https://drive.google.com/uc?id=1qOT38Cm7aYBoSdbIQPylhwJfIJhdkuIe[/img]
 
Based on this guide, at
the main screens
it is recommended to use the BottomAppBar layout, which shows several items in the menu and the centered FAB (Floating Action Button). At
secondary screens
, the transition to which is carried out from the main, the BottomAppBar layout should consist of a right-aligned FAB and several additional items in the menu. Transitions between these two screens should be performed properly. Gif above shows this guide.
 
Now let's see how this behavior can be realized. We have two xml-files in the folder res /menu for each screen menu:
 

    <?xml version="1.0" encoding="utf-8"?>

 
    <?xml version="1.0" encoding="utf-8"?>

 

When there is a transition between screens, for example, by pressing the button TOGGLE SCREEN in our case, the BottomAppBar layout, including the menu and the FAB, should change. Here is the base code for this behavior of the BottomAppBar layout:


 
    //Hide navigation drawer icon
bottom_app_bar.navigationIcon = null
//Move FAB from the center of BottomAppBar to the end of it
bottom_app_bar.fabAlignmentMode = BottomAppBar.FAB_ALIGNMENT_MODE_END
//Replace the action menu
bottom_app_bar.replaceMenu (bottomappbar_menu_secondary)
//Change FAB icon
fab? .setImageDrawable (baseline_reply_white_24)

 

If you want to make animated transitions, you need an additional code. You can learn the source code attached at the end of this article, in which you will find the animation.


 

Scrolling


 

Scrolling is an important behavior trigger for components such as BottomAppBar. On the Material Design guideline page, the following behavior is recommended for this case:


 
When scrolling BottomAppBar may appear or disappear:
 
- Scrolling down hides BottomAppBar. If it was FAB, it disconnects from the panel and stays on the screen.
 
- Scrolling up shows BottomAppBar and rejoins it to FAB if it was there.

Below is a demonstration of the behavior of BottomAppBar when scrolling.


 

[img]https://drive.google.com/uc?id=1CKxIFgoMuXIZePHZ-kRPBsjgbK05hvp7[/img]


 

To use this behavior, BottomAppBar and FAB must be direct children of CoordinatorLayout . Then we include hideonscroll and set the scrolling flags for BottomAppBar:


 

 

This is enough to implement such behavior BottomAppBar.


 

Elevation


 

Each component in the world of Material Design has an elevation similar to our physical world. At BottomAppBar the elevation is 8dp , and the content of the screen itself rises to 0dp . FAB in the static state rises to 12dp . The two components that we will recall in this article, Navigation Drawer and Snackbar, rise to 16dp and 6dp respectively.


 

Typically, Snackbar is a component for notifying the user, popping up from the bottom of the screen. But if the screen has BottomAppBar or Navigation Drawer, Snackbar behavior should change. In these cases, Snackbar should show over lower components. Here is a demonstration and the corresponding code for implementation:


 

[img]https://drive.google.com/uc?id=1duPRNVKW1eaCYp5QZqbqH8-v5MEakfLV[/img]


 
    private fun displayMaterialSnackBar () {
val marginSide = 0
val marginBottom = 550
val snackbar = Snackbar.make (

? coordinatorLayout?
"FAB Clicked",
Snackbar.LENGTH_LONG
) .setAction ("UNDO") {}
//Changing message text color
snackbar.setActionTextColor (ContextCompat.getColor (this, R.color.colorSnackbarButton))
val snackbarView = snackbar.view
val params = snackbarView.layoutParams as CoordinatorLayout.LayoutParams
params.setMargins (

? params.leftMargin + marginSide,

? params.topMargin,
params.rightMargin + marginSide,
params.bottomMargin + marginBottom
)
snackbarView.layoutParams = params
snackbar.show ()
}


 

As we already mentioned, the Navigation Drawer rises to 16dp , which means - according to the guide -


 
Menus dropping out of BottomAppBar (for example, Navigation Drawer) open as modal windows a level higher than BottomAppBar itself.

Below is the implementation of our Navigation Drawer:


 

[img]https://drive.google.com/uc?id=1DDDGP-FT0Ylb269JZpS0xKX2L51uWPi1[/img]


 

The Navigation Drawer is modal window and therefore follows the above implementation rule.


 

Details of the implementation of this behavior are as follows. In the folder res /menu an xml menu file must be created for Navigation View , which will be used in Navigation Drawer:


 
    <?xml version="1.0" encoding="utf-8"?>

 
Then a layout file must be created for the fragment using Navigation Drawer:
 

Github . Comment and ask questions.
 
← Implementation of BottomAppBar. Part 1: Material components for Android
 
← Implementation of BottomAppBar. Part 2: Menu and control of the Navigation Drawer

It may be interesting

  • Comments
  • About article
  • Similar news
This publication has no comments.

weber

Author

24-09-2018, 16:26

Publication Date

Development of mobile applications / Programming

Category
  • Comments: 0
  • Views: 466
Overview of Android Design Support
Digest of interesting materials for
Flutter for Android developers. How to
Implementation of BottomAppBar. Part 1:
Navigation Architecture Component.
Android Support Library 28. What's new?
Write a comment
Name:*
E-Mail:


Comments
this is really nice to read..informative post is very good to read..thanks a lot! How is the cost of house cleaning calculated?
Yesterday, 17:14

Legend SEO

It’s very informative and you are obviously very knowledgeable in this area. You have opened my eyes to varying views on this topic with interesting and solid content.

entegrasyon programları
Yesterday, 17:09

taxiseo2

I am really enjoying reading your well written articles. It looks like you spend a lot of effort and time on your blog. I have bookmarked it and I am looking forward to reading new articles. Keep up the good work.

entegrasyon programları
Yesterday, 17:02

taxiseo2

I found so many interesting stuff in your blog especially its discussion. From the tons of comments on your articles, I guess I am not the only one having all the enjoyment here! keep up the good work...먹튀

Yesterday, 16:50

raymond weber

Lose Weight Market provides the best fitness tips, workout guides, keto recipes and diet plans, yoga workout routine and plans, healthy recipes, and more! Check Out: Lose Weight Market


Corvus Health provides medical training services as well as recruiting high quality health workers for you or placing our own best team in your facility. Check Out: Health Workforce Recruitment




I.T HATCH offers a wide range of IT services including remote access setup, small business servers, data storage solutions, IT strategy services, and more. Check Out: IT strategy services
Yesterday, 22:33

noorseo

Adv
Website for web developers. New scripts, best ideas, programming tips. How to write a script for you here, we have a lot of information about various programming languages. You are a webmaster or a beginner programmer, it does not matter, useful articles will help to make your favorite business faster.

Login

Registration Forgot password