BottomNavigation


Source link: https://github.com/gwoodhouse/BottomNavigation

Bottom Navigation

An implementation of the "Bottom Navigation" component from Google Material Design spec.

Please look here to view the full component specification.

This library does not implement the "Left Navigation" as per the Tablet specification.

This library does not implement text/icon tinting as of yet.

Default usage

To be placed as the final View in a CoordinatorLayout:

<ca.gcastle.bottomnavigation.view.BottomNavigationView
  android:id="@+id/bottomBar"
  android:layout_width="match_parent"
  android:layout_height="56dp"
  android:layout_gravity="bottom"
  app:layout_behavior="ca.gcastle.bottomnavigation.behaviour.BottomNavigationBehavior">

<ca.gcastle.bottomnavigation.view.BottomNavigationTabView

android:layout_width="wrap_content"

android:layout_height="match_parent"

android:id="@+id/tab1"

app:tabImage="@drawable/ic_home_white_24dp"

app:tabText="tab1"

app:tabColor="@color/colorPrimary"/>

<ca.gcastle.bottomnavigation.view.BottomNavigationTabView

android:layout_width="wrap_content"

android:layout_height="match_parent"

android:id="@+id/tab2"

app:tabImage="@drawable/ic_search_white_24dp"

app:tabText="tab2"

app:tabColor="@color/colorAccent"/>

<ca.gcastle.bottomnavigation.view.BottomNavigationTabView

android:layout_width="wrap_content"

android:layout_height="match_parent"

android:id="@+id/tab3"

app:tabImage="@drawable/ic_help_white_24dp"

app:tabText="tab3"

app:tabColor="#00BCD4"/>  </ca.gcastle.bottomnavigation.view.BottomNavigationView> 

The above implementation gives the following behaviour:

Optional parameters

BottomNavigationView

[Optional]

app:navGrowTabs="false"

If you don't want the tabs to grow when selected use "false". Either "true" or "false, defaults to true.

app:navGrowthModifier="32dp"

The amount a tab grows when selected. Default value is 64dp. Is ignored if navGrowTabs is set to false.

app:navShowCircleReveal="false"

Decide if you want a circular reveal effect on the background colour, or whether to simply switch colours.

BottomNavigationTabView

Required

app:tabImage="@drawable/icon1"

The drawable to display for this tab

app:tabText="@string/tab1"

The text to display for this tab.

app:tabColor="#0000FF

The colour background for this tab - used by BottonNavigationView in it's circular reveal

[Optional]

app:alwaysShowText="true"

Ensure text is always visible. Defaults to false.

app:unselectedAlpha="0.2"

Customise the opacity of unselected items. Between 0 and 1. Defaults to 0.8

How to use

Maven

<dependency>
<groupId>ca.gcastle</groupId>
<artifactId>BottomNavigation</artifactId>
<version>1.0.0</version>
<type>pom</type> </dependency> 

Gradle

compile 'ca.gcastle:BottomNavigation:1.0.0' 

Ivy

<dependency org='ca.gcastle' name='BottomNavigation' rev='1.0.0'>
<artifact name='$AID' ext='pom'></artifact> </dependency> 

Thanks

Thanks go to:

  • Adam McNeilly for his sample application - View his other contributions to the open source community here: http://adammcneilly.com/100days/
  • Eric Cugota for his documentation on how to publish a library to jcenter which is available here
  • The members of Android/room-15 on StackOverflow for their support critiquing code and offering support.

License

My work is distributed under the Apache License.

Bottom Navigation library for Android Copyright (c) 2016 Graeme Castle (https://github.com/gwoodhouse/BottomNavigation).  Licensed 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.0  Unless required by applicable law or agreed to in writing, software distributed 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 and limitations under the License. 

This library uses modified source for the Coordinator Layout Behaviour from Nikola Despotoski

BottomNavigationLayout library for Android Copyright (c) 2016. Nikola Despotoski (http://github.com/NikolaDespotoski). Licensed 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.0  Unless required by applicable law or agreed to in writing, software distributed 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 and limitations under the License. 

Resources

A EditText with a constant text in the end.

Gradle plugin to send Slack messages according to your build lifecycle. Useful to integrate with a CI server, to notify everyone that some gradle task has failed.

Blurry is a easy blur library for Android.

A library containing over 1000 material vector icons that can be easily used as Drawable or as a standalone View. Tired of having to search for and generate png resources every time you want to test something? This library puts an end to that burden and makes swapping icons a breeze, check out the usage below and you'll see why.

More convenient and easy to use android Log manager.

Android library build on top of retrofit, for simple handling of authenticated requests.

Topics


2D Engines   3D Engines   9-Patch   Action Bars   Activities   ADB   Advertisements   Analytics   Animations   ANR   AOP   API   APK   APT   Architecture   Audio   Autocomplete   Background Processing   Backward Compatibility   Badges   Bar Codes   Benchmarking   Bitmaps   Bluetooth   Blur Effects   Bread Crumbs   BRMS   Browser Extensions   Build Systems   Bundles   Buttons   Caching   Camera   Canvas   Cards   Carousels   Changelog   Checkboxes   Cloud Storages   Color Analysis   Color Pickers   Colors   Comet/Push   Compass Sensors   Conferences   Content Providers   Continuous Integration   Crash Reports   Credit Cards   Credits   CSV   Curl/Flip   Data Binding   Data Generators   Data Structures   Database   Database Browsers   Date &   Debugging   Decompilers   Deep Links   Dependency Injections   Design   Design Patterns   Dex   Dialogs   Distributed Computing   Distribution Platforms   Download Managers   Drawables   Emoji   Emulators   EPUB   Equalizers &   Event Buses   Exception Handling   Face Recognition   Feedback &   File System   File/Directory   Fingerprint   Floating Action   Fonts   Forms   Fragments   FRP   FSM   Functional Programming   Gamepads   Games   Geocaching   Gestures   GIF   Glow Pad   Gradle Plugins   Graphics   Grid Views   Highlighting   HTML   HTTP Mocking   Icons   IDE   IDE Plugins   Image Croppers   Image Loaders   Image Pickers   Image Processing   Image Views   Instrumentation   Intents   Job Schedulers   JSON   Keyboard   Kotlin   Layouts   Library Demos   List View   List Views   Localization   Location   Lock Patterns   Logcat   Logging   Mails   Maps   Markdown   Mathematics   Maven Plugins   MBaaS   Media   Menus   Messaging   MIME   Mobile Web   Native Image   Navigation   NDK   Networking   NFC   NoSQL   Number Pickers   OAuth   Object Mocking   OCR Engines   OpenGL   ORM   Other Pickers   Parallax List   Parcelables   Particle Systems   Password Inputs   PDF   Permissions   Physics Engines   Platforms   Plugin Frameworks   Preferences   Progress Indicators   ProGuard   Properties   Protocol Buffer   Pull To   Purchases   Push/Pull   QR Codes   Quick Return   Radio Buttons   Range Bars   Ratings   Recycler Views   Resources   REST   Ripple Effects   RSS   Screenshots   Scripting   Scroll Views   SDK   Search Inputs   Security   Sensors   Services   Showcase Views   Signatures   Sliding Panels   Snackbars   SOAP   Social Networks   Spannable   Spinners   Splash Screens   SSH   Static Analysis   Status Bars   Styling   SVG   System   Tags   Task Managers   TDD &   Template Engines   Testing   Testing Tools   Text Formatting   Text Views   Text Watchers   Text-to   Toasts   Toolkits For   Tools   Tooltips   Trainings   TV   Twitter   Updaters   USB   User Stories   Utils   Validation   Video   View Adapters   View Pagers   Views   Watch Face   Wearable Data   Wearables   Weather   Web Tools   Web Views   WebRTC   WebSockets   Wheel Widgets   Wi-Fi   Widgets   Windows   Wizards   XML   XMPP   YAML   ZIP Codes