NiceBottomBar
A lightweight Android material bottom navigation bar library
GIF
<img src="https://github.com/ibrahimsn98/NiceBottomBar/blob/master/art/gif.gif?raw=true"/>Usage
- Create menu.xml under your res/menu/ folder
<?xml version="1.0" encoding="utf-8"?>
<menu xmlns:android="http://schemas.android.com/apk/res/android">
<item
android:id="@+id/item0"
android:title="@string/servers"
android:icon="@drawable/ic_dns_black_24dp" />
<item
android:id="@+id/item1"
android:title="@string/search"
android:icon="@drawable/ic_search_black_24dp" />
<item
android:id="@+id/item2"
android:title="@string/billing"
android:icon="@drawable/ic_receipt_black_24dp" />
<item
android:id="@+id/item3"
android:title="@string/account"
android:icon="@drawable/ic_account_circle_black_24dp" />
</menu>
- Add view into your layout file
<me.ibrahimsn.lib.NiceBottomBar
android:id="@+id/bottomBar"
android:layout_width="match_parent"
android:layout_height="60dp"
app:menu="@menu/bottom_menu" />
- Use NiceBottomBar functions in your activity
bottomBar.setActiveItem(1)
bottomBar.setBadge(2)
bottomBar.removeBadge(2)
bottomBar.onItemSelected = {
status.text = "Item $it selected"
}
bottomBar.onItemReselected = {
status.text = "Item $it re-selected"
}
bottomBar.onItemLongClick = {
status.text = "Item $it long click"
}
OR
bottomBar.setOnItemSelectedListener(object: OnItemSelectedListener {
override fun onItemSelect(pos: Int) {
status.text = "Item $pos selected"
}
})
bottomBar.setOnItemReselectedListener(object: OnItemReselectedListener {
override fun onItemReselect(pos: Int) {
status.text = "Item $pos re-selected"
}
})
bottomBar.setOnItemLongClickListener(object: OnItemLongClickListener {
override fun onItemLongClick(pos: Int) {
status.text = "Item $pos long click"
}
})