Android design pattern based BottomBarNavigation
Android specific bottom bar navigation should be based on some specification, which is described in Google's site (mentioned below)
https://www.google.com/design/spec/components/bottom-navigation.html
To create a library for android projects, to easily implement the bottom bar navigation
- Can add upto 3 buttons in the bottom bar
- Can change colors of the bottom bar and bottom bar button texts
- Add a class to create a button drawable, requires only a drawable_icon and color of the normal and pressed state
- Configure to add more than 3 buttons in the bottom bar
- Make the integration of the library much simpler and generic
compile 'com.github.karthyks:bottombarnavigation:0.1'
or
Import as a module into your android project.Add dependency in your gradle
compile project(':bottomBarNavigation')
include ':yourprojectname', ':bottomBarNavigation'
bottomBarView = (BottomBarView) view.findViewById(R.id.bottom_bar);
bottomBarView.setBgColor(Color.GRAY);
include_bottom_bar_buttons.xml
```xml<com.github.karthyks.bottombarnavigation.views.BottomBarButton
android:id="@+id/btn_2"
android:layout_width="wrap_content"
android:layout_height="wrap_content"/>
<com.github.karthyks.bottombarnavigation.views.BottomBarButton
android:id="@+id/btn_3"
android:layout_width="wrap_content"
android:layout_height="wrap_content"/>
bottomBarView.addAsChild(R.layout.include_bottom_bar_buttons);
private void buildBottomBarButtons() {
btn1.setButtonDrawables(int DrawableNormal, int DrawablePressed)
.setButtonText("BUTTON_TEXT")
.setTextColors(int colorNormal, int colorPressed)
.setBgColor(Color.GRAY)
.build();
btn2.setButtonDrawables(int DrawableNormal, int DrawablePressed)
.setButtonText("BUTTON_TEXT")
.setTextColors(int colorNormal, int colorPressed)
.setBgColor(Color.GRAY)
.build();
btn3.setButtonDrawables(int DrawableNormal, int DrawablePressed)
.setButtonText("BUTTON_TEXT")
.setTextColors(int colorNormal, int colorPressed)
.setBgColor(Color.GRAY)
.build();
btn1.setOnClickListener(this);
btn2.setOnClickListener(this);
btn3.setOnClickListener(this);
}
Feel free to fork your changes in the library.Since this is my first library project, I am sure there will be a lot of suggestions from Geekies.