You signed in with another tab or window.Reload to refresh your session.You signed out in another tab or window.Reload to refresh your session.You switched accounts on another tab or window.Reload to refresh your session.Dismiss alert
A nice looking Spotify like bottom navigation view
Usage
Create Menu File
Create a menu file below resource folder. Right click to res then New > Android Resource File, type a file name and make sure you choose ResourceType as Menu. Here is a sample menu file. You can add android:checked="true" if you want that menu item active at the begin
Here are some comments about what xml attributes do
/** * app:menu -> Provide a menu for bottom view items * app:active_color -> The color of the active and choosen menu item * app:passive_color -> The color of non active menu items * app:pressed_color -> The color when you press on menu item * app:item_text_size -> The size of the menu item text * app:item_padding -> The padding of the menu item * app:animation_duration="300" -> The amount of time of the click animation * app:scale_percent="5" -> The percent of downsizing animation. If its 50 view will downsize to half and full again*/
Code Side
If you want to be notified about the change of navigation item you can implement OnNavigationItemChangeListener
val bottomify= findViewById<BottomifyNavigationView>(R.id.bottomify_nav) bottomify.setOnNavigationItemChangedListener(object:OnNavigationItemChangeListener {overridefunonNavigationItemChanged(navigationItem:BottomifyNavigationView.NavigationItem) {Toast.makeText(this@MainActivity,"Selected item at index${navigationItem.position}",Toast.LENGTH_SHORT).show() } })
If you want to set active item not by a click but programmatically
bottomify.setActiveNavigationIndex(2)
Influence
Spotify
This project influenced by Spotify's good looking bottom bar
Download
Step 1. Add the JitPack repository to your build file
Add it in your root build.gradle at the end of repositories:
Copyright 2018 Volkan ŞahinLicensed under the Apache License, Version 2.0 (the "License");you may not use this file except in compliance with the License.You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0Unless required by applicable law or agreed to in writing, softwaredistributed under the License is distributed on an "AS IS" BASIS,WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.See the License for the specific language governing permissions andlimitations under the License.
About
A nice looking Spotify like bottom navigation view