Code Monkey home page Code Monkey logo

smoothbottombar's Introduction

SmoothBottomBar

A lightweight Android material bottom navigation bar library

API Android Arsenal Android Weekly

GIF

Design Credits

All design and inspiration credits belong to Alejandro Ausejo.

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/menu_dashboard"
        android:icon="@drawable/ic_dashboard_white_24dp"/>

    <item
        android:id="@+id/item1"
        android:title="@string/menu_leaderboard"
        android:icon="@drawable/ic_multiline_chart_white_24dp"/>

    <item
        android:id="@+id/item2"
        android:title="@string/menu_store"
        android:icon="@drawable/ic_store_white_24dp"/>

    <item
        android:id="@+id/item3"
        android:title="@string/menu_profile"
        android:icon="@drawable/ic_person_outline_white_24dp"/>

</menu>
  • Add view into your layout file
<me.ibrahimsn.lib.SmoothBottomBar
    android:id="@+id/bottomBar"
    android:layout_width="match_parent"
    android:layout_height="70dp"
    app:backgroundColor="@color/colorPrimary"
    app:badgeColor="@color/colorBadge"
    app:menu="@menu/menu_bottom"/>
  • Use SmoothBottomBar callbacks in your activity
bottomBar.onItemSelected = {
    status.text = "Item $it selected"
}

bottomBar.onItemReselected = {
    status.text = "Item $it re-selected"
}

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"
    }
})

Note: For projects without kotlin, you may need to add org.jetbrains.kotlin:kotlin-stdlib:$kotlinVersion to your dependencies since this is a Kotlin library.

Use SmoothBottomBar with Navigation Components.

Coupled with the Navigation Component from the Android Jetpack, SmoothBottomBar offers easier navigation within your application by designating navigation to the Navigation Component. This works best when using fragments, as the Navigation component helps to handle your fragment transactions.

  • Setup Navigation Component i.e. Add dependenccy to your project, create a Navigation Graph etc.
  • For each Fragment in your Navigation Graph, ensure that the Fragment's id is the same as the MenuItems in your Menu i.e res/menu/ folder
<?xml version="1.0" encoding="utf-8"?>
<menu xmlns:android="http://schemas.android.com/apk/res/android">

    <item
        android:id="@+id/first_fragment"
        android:title="@string/menu_dashboard"
        android:icon="@drawable/ic_dashboard_white_24dp"/>

    <item
        android:id="@+id/second_fragment"
        android:title="@string/menu_leaderboard"
        android:icon="@drawable/ic_multiline_chart_white_24dp"/>

    <item
        android:id="@+id/third_fragment"
        android:title="@string/menu_store"
        android:icon="@drawable/ic_store_white_24dp"/>

    <item
        android:id="@+id/fourth_fragment"
        android:title="@string/menu_profile"
        android:icon="@drawable/ic_person_outline_white_24dp"/>

</menu>

Navigation Graph i.e res/navigation/ folder

<?xml version="1.0" encoding="utf-8"?>
<navigation xmlns:android="http://schemas.android.com/apk/res/android"
    xmlns:app="http://schemas.android.com/apk/res-auto"
    xmlns:tools="http://schemas.android.com/tools"
    android:id="@+id/nav_graph"
    app:startDestination="@id/first_fragment">

    <fragment
        android:id="@+id/first_fragment"
        android:name="me.ibrahimsn.smoothbottombar.FirstFragment"
        android:label="Dashboard"
        tools:layout="@layout/fragment_first" >
        <action
            android:id="@+id/action_firstFragment_to_secondFragment"
            app:destination="@id/second_fragment" />
    </fragment>
    <fragment
        android:id="@+id/second_fragment"
        android:name="me.ibrahimsn.smoothbottombar.SecondFragment"
        android:label="Leaderboard"
        tools:layout="@layout/fragment_second" >
        <action
            android:id="@+id/action_secondFragment_to_thirdFragment"
            app:destination="@id/third_fragment" />
    </fragment>
    <fragment
        android:id="@+id/third_fragment"
        android:name="me.ibrahimsn.smoothbottombar.ThirdFragment"
        android:label="Store"
        tools:layout="@layout/fragment_third" >
        <action
            android:id="@+id/action_thirdFragment_to_fourthFragment"
            app:destination="@id/fourth_fragment" />
    </fragment>
    <fragment
        android:id="@+id/fourth_fragment"
        android:name="me.ibrahimsn.smoothbottombar.FourthFragment"
        android:label="Profile"
        tools:layout="@layout/fragment_fourth" />
</navigation>
  • In your activity i.e MainActivity, create an instance of PopupMenu which takes a context and an anchor(pass in null) and then inflate this PopupMenu with the layout menu for the SmoothBottomBar.
  • Get a reference to your SmoothBottomBar and call setupWithNavController() which takes in a Menu and NavController, pass in the menu of the previously instantiated PopupMenu i.e.(popUpMenu.menu) and your NavController.
  • Preferably set this up in a function as shown below and call this function i.e. (setupSmoothBottomMenu()) in the onCreate method of your activity.

N.B: Sample app makes use of ViewBinding to get reference to views in the layout.

   private fun setupSmoothBottomMenu() {
        binding.bottomBar.setupWithNavController(navController)
   }

ActionBar

You can also setup your ActionBar with the Navigation Component by calling setupActionBarWithNavController and pass in your NavController.

N.B: Your app needs to have a Toolbar for setupActionBarWithNavController to work. If your app theme doesn't have a Toolbar i.e. (Theme.AppCompat.Light.NoActionBar) you would need to:

  • Add one to your layout i.e.
 <com.google.android.material.appbar.AppBarLayout
        android:id="@+id/app_bar_layout"
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        app:layout_constraintEnd_toEndOf="parent"
        app:layout_constraintStart_toStartOf="parent"
        app:layout_constraintTop_toTopOf="parent">
        <androidx.appcompat.widget.Toolbar
            android:id="@+id/toolBar"
            android:layout_width="match_parent"
            android:layout_height="wrap_content" />
    </com.google.android.material.appbar.AppBarLayout>
  • Set the support action bar to your Toolbar using setSupportActionBar(your_toolbar_id) in this case setSupportActionBar(binding.toolBar)

We now have something like this:

 private lateinit var navController: NavController
 private lateinit var binding: ActivityMainBinding

    override fun onCreate(savedInstanceState: Bundle?) {
        super.onCreate(savedInstanceState)
        binding = ActivityMainBinding.inflate(layoutInflater)
        setContentView(binding.root)
        navController = findNavController(R.id.main_fragment)
        setupActionBarWithNavController(navController)
        setupSmoothBottomMenu()
    }
    
    private fun setupSmoothBottomMenu() {
        binding.bottomBar.setupWithNavController(navController)
    }

    //set an active fragment programmatically
    fun setSelectedItem(pos:Int){
        binding.bottomBar.setSelectedItem(pos)
    }
    //set badge indicator
    fun setBadge(pos:Int){
        binding.bottomBar.setBadge(pos)
    }
    //remove badge indicator
    fun removeBadge(pos:Int){
        binding.bottomBar.removeBadge(pos)
    }

    override fun onSupportNavigateUp(): Boolean {
        return navController.navigateUp() || super.onSupportNavigateUp()
    }

Result Demo:

Update [8th May, 2021]

Prior to the initial addition of this feature, you can now inflate separate menu items for the SmoothBottomBar and your Toolbar.

  • Create the menu item you want to inflate in the Toolbar i.e.
<?xml version="1.0" encoding="utf-8"?>
<menu xmlns:android="http://schemas.android.com/apk/res/android">
    <item
        android:id="@+id/another_item_1"
        android:title="Another Item 1" />
    <item
        android:id="@+id/another_item_2"
        android:title="Another Item 2" />
    <item
        android:id="@+id/another_item_3"
        android:title="Another Item 3" />
</menu>
  • Override OnCreateOptionsMenu and onOptionsItemSelected (ensure it returns super.onOptionsItemSelected(item)). Now we have:
  class MainActivity : AppCompatActivity() {
    private lateinit var navController: NavController
    private lateinit var binding: ActivityMainBinding

    override fun onCreate(savedInstanceState: Bundle?) {
        super.onCreate(savedInstanceState)
        binding = ActivityMainBinding.inflate(layoutInflater)
        setContentView(binding.root)
        navController = findNavController(R.id.main_fragment)
        setupActionBarWithNavController(navController)
        setupSmoothBottomMenu()
    }

    override fun onCreateOptionsMenu(menu: Menu?): Boolean {
        menuInflater.inflate(R.menu.another_menu, menu)
        return true
    }

    override fun onOptionsItemSelected(item: MenuItem): Boolean {
        when (item.itemId) {
            R.id.another_item_1 -> {
                showToast("Another Menu Item 1 Selected")
            }

            R.id.another_item_2 -> {
                showToast("Another Menu Item 2 Selected")
            }

            R.id.another_item_3 -> {
                showToast("Another Menu Item 3 Selected")
            }
        }
        return super.onOptionsItemSelected(item)
    }


    private fun showToast(msg: String) {
        Toast.makeText(this, msg, Toast.LENGTH_SHORT).show()
    }

    private fun setupSmoothBottomMenu() {
        binding.bottomBar.setupWithNavController(navController)
    }

    //set an active fragment programmatically
    fun setSelectedItem(pos:Int){
        binding.bottomBar.setSelectedItem(pos)
    }
    //set badge indicator
    fun setBadge(pos:Int){
        binding.bottomBar.setBadge(pos)
    }
    //remove badge indicator
    fun removeBadge(pos:Int){
        binding.bottomBar.removeBadge(pos)
    }

    override fun onSupportNavigateUp(): Boolean {
        return navController.navigateUp() || super.onSupportNavigateUp()
    }
}

Select Bottom Item from any fragment

    buttonId.setOnClickListener {
        (requireActivity() as MainActivity).setSelectedItem(2)
    }

Result Demo:

Customization

<me.ibrahimsn.lib.SmoothBottomBar
        android:id="@+id/bottomBar"
        android:layout_width="match_parent"
        android:layout_height="70dp"
        app:menu=""
        app:backgroundColor=""
        app:indicatorColor=""
        app:indicatorRadius=""
        app:cornerRadius=""
        app:corners=""
        app:sideMargins=""
        app:itemPadding=""
        app:textColor=""
        app:badgeColor=""
        app:itemFontFamily=""
        app:textSize=""
        app:iconSize=""
        app:iconTint=""
        app:iconTintActive=""
        app:activeItem=""
        app:duration="" />

Setup

Follow me on Twitter @ibrahimsn98

//project label build.gradle
buildscript {
    repositories {
         ....
        maven { url 'https://jitpack.io' }
    }
}

allprojects {
    repositories {
     .......
        maven { url 'https://www.jitpack.io' }
    }
}
//app label build.gradle
dependencies {
        implementation 'com.github.ibrahimsn98:SmoothBottomBar:1.7.9'
}

Contributors โœจ


brookmg

rezaepsilon0

amitdash291

tobiasschuerg

mayokunthefirst

FannyDemey

Milad akarie

Milon27

License

MIT License

Copyright (c) 2019 ฤฐbrahim Sรผren

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.

smoothbottombar's People

Contributors

1701413420 avatar amitdash291 avatar brookmg avatar ibrahimsn98 avatar jisungbin avatar joymajumdar2001 avatar mayokunadeniyi avatar milon27 avatar pereved avatar rezaabedi261 avatar tobiasschuerg avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

smoothbottombar's Issues

Java Version of the Library

Can we also please have a java version if the library. This library is awesome but java developers like me can't take it in use.

MVVM Support

Can we integrate this in MVVM architecture using data binding?

Tapping on tabs does nothing

Hey,

Great looking bottom bar you got here. I took a look by adding it to an empty template app from Android Studio 4 and it doesn't seem to work. The bar appears but it stays on the first tab.

  1. I added the Gradle lines.
  2. I created the menu.xml (FYI the readme says menu.xml but the SmoothBottomBar looks for menu_bottom )
  3. I added the SmoothBottomBar View
  4. Added the listeners in the mainActivity.

I stopped here to test it to see how it feels but as I say nothing happens when you touch any part of the bar. Pity.

Best of luck with it

I want a java version

This library is amazing, I really want to try it, but I won't kotlin.Can you help me?
Thank you.

How to change background shape?

How to change background shape from drawable resource file, maybe we want to use custom background that rounded in topLeftCorner and topRightCorner.

backstack problem

on backpressed the bottomnavigation icon also must be changed it's not working
ezgif com-optimize

Is it possible to hide fragment and icon in BottomNavigationBar

I have a requirement to hide the Fragment and its Icon in BottomNavigationBar if the boolean value is true. if(hideFrag){ select_fragment=null; }else{ select_fragment = new Fragment4();}

this one just hides the fragment but not the icon how to deal with it.

Same menu in Bottom in action bar

Hello @ibrahimsn98 @rezaepsilon0 @mayokunthefirst @brookmg @tobiasschuerg

Please look in to this issue, Bottom and action bar menus are same, if user want to show other menu option in toolbar with icon, then how they will show, because menu already occupied with bottom navigation. without this solution library not useful for live projects or apps, please solve that.

Thanks

Disable text shortening

Hi,
Thank you for the great work you've done with this library!
I use it and it almost fits with the designer's expectations.

The only problem I'm facing is I need to show the full text without shortening it.
Is it currently possible?

If not, I think it could be a nice feature!

setting app:activeItem="#" anything other than 0 via XML causes view to change active item with noticeable delay from 0 to that desired position at startup

video_2021-02-24_21-46-28.mp4

When setting activeItem from XML I expect it to set that item active at startup, I can clearly see that at first startup, item at position 0 is set then item at position which I set in XML will be set as active.
Don't let quality and low frame rate of GIF fool you I already tested this situation in several devices and android versions also in an Emulator in a decent computer.
BTW I took the liberty of inspecting your library source and as I guessed initial value for activeItem is 0 which explains the situation where at first initial active item is 0, investing further there's a setter method for another variable coupled with that which shows applyItemActiveIndex() method which I guess is responsible for changing active item index and animations for that matter. further trace shows that itemActiveIndex is set to attribute from XML and in setter method of itemActiveIndex, as explained recently applyItemActiveIndex() is called so I don't see why first item at position 0 is set as active then item at position where developer set from XML so it seems to me code is OK except that maybe onSizeChanged method is called in initial view creation and in that method this line (applyItemActiveIndex) is called so maybe this is causing the issue. I'm not sure about view lifecycle so how can that method being called before object consternation is beyond me, I should investigate more.

Dynamically change bottom bar item

I want to show bottom bar item when user login check type of login user and based on user i want to show 2 tab or 3 tab dynamically change bottom items

set Badge

how can i set badge for every item? (with navigation component)

Java version

Hy, It is a great library, but i can not code in kotlin. So my question is: Is there perhaps a java version of this library? If so, than could you please link it for me?
Thank you for your answer!

How to hook up with navController?

I am a newbie and am currently working with a single activity and multiple fragments pattern. I want to integrate this smooth bar with the navController.

I tried doing this:

bottomBar.onItemSelected = {
            when (it) {
                0 -> navController.navigate(R.id.someFragment)
                1 -> navController.navigate(R.id.someOtherFragment)
                else -> navController.navigate(R.id.someFragment)
            }
        }

But this would create a new fragment every time instead of using the existing fragment in the navigation stack. I looked up the documentation and it only teaches how to integrate it with the bottom navigation view they provided.

Is it possible to somehow setup the nav controller? And if not, are there any workarounds?

Change Font famIly

How can we change the font family and change it to custom font in SmoothBottomBar? Please help.

Item gravity

How can we use this as an icon top and text bottom?

How change languaje programatically

How can the language of the items be changed programmatically, since it does not allow me to do it only does it with an element.

I hope you can help me, Thanks!

SmoothBottomBar not supported as per NavController requirements

As per new guidelines by developer.android.com, Now BottomNavigationView is operated using ViewModel and NavController but SmoothBottomBar is unable to support that

error: no suitable method found for setupWithNavController(SmoothBottomBar,NavController)
        NavigationUI.setupWithNavController(navView, navController);
                    
    method NavigationUI.setupWithNavController(Toolbar,NavController) is not applicable
      (argument mismatch; SmoothBottomBar cannot be converted to Toolbar)
    method NavigationUI.setupWithNavController(NavigationView,NavController) is not applicable
      (argument mismatch; SmoothBottomBar cannot be converted to NavigationView)
    method NavigationUI.setupWithNavController(BottomNavigationView,NavController) is not applicable

Not Detected in Instumentation Tests

I just tried to test my app interface, but it does not seem espresso can detect it. Neither manually code the test nor using record test (which is works when i use default navigation bar component). Anyone has tried to test it? Any workaround is appreciated since this library has good looking design for me.

I want onItemSelected function for Java

Hello i tried this library for my project, but I am unable to use onItemSelected function. Instead i get setOnItemSelected function but couldn't understand it as to how to use it. Please help. How do i switch fragment when bottombar item changes, in Java. Please help.

Menu with no icons causes application to crash

I was populating the bottom navigation with the menu, all my items did not have an icon as I planned to add them later on. The bottom navigation kept on crashing with the main error as follows:

Error inflating class me.ibrahimsn.lib.SmoothBottomBar

After a closer look into the logcat revealed the following error:

Caused by: kotlin.KotlinNullPointerException at me.ibrahimsn.lib.BottomBarParser.getTabConfig(BottomBarParser.kt:48) at me.ibrahimsn.lib.BottomBarParser.parse(BottomBarParser.kt:23)

After a few hours of debugging and looking through your code, I figured out that the library is trying to load icon and not finding any. Please put a note in the library description or handle it with a try-catch.
PS: Very Cool Library, great work.
Happy Coding.

deselect

hi
how i can deselect all items

setCurrentItem method missing

setCurrentItem method is missing from the SmoothBottomBar class. This is required if I want to manually switch the tab programmatically.
Similarly getCurrentItem method is missing as well.

Please provide some workaround for this.

Thanks

Library support before Android X. Getting build error

My project is not currently supporting Android X.
Hence while integrating library, I am getting following build error:

Manifest merger failed : Attribute application@appComponentFactory value=(android.support.v4.app.CoreComponentFactory) from [com.android.support:support-compat:28.0.0] AndroidManifest.xml:22:18-91
is also present at [androidx.core:core:1.1.0] AndroidManifest.xml:24:18-86 value=(androidx.core.app.CoreComponentFactory).

Is there any support before Android X for this library?

Thanks.

Crash - "IndexOutOfBoundsException" at starting of the app in Android 10

Device Info - Samsung Galaxy M10s, Android 10
-one thing I like to share here is I noticed that error occurred when the device is offline and I noticed this issue in -
Redmi Note 8, Android Version 9

In xml -
<me.ibrahimsn.lib.SmoothBottomBar
android:id="@+id/bottom_nav"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="?background_default_darker"
android:layout_marginBottom="12dp"
app:cornerRadius="8dp"
app:elevation="12dp"
app:iconSize="24dp"
app:iconTint="@color/grey500"
app:iconTintActive="@color/black"
app:indicatorColor="@color/greyF6"
app:itemFontFamily="@font/poppins"
app:menu="@menu/bottom_nav_home"
app:textColor="@color/black" />

In menu items, I used vector drawable.

crash info -
java.lang.IndexOutOfBoundsException: Empty list doesn't contain element at index 0.
at kotlin.collections.EmptyList.get(Collections.kt:35)
at kotlin.collections.EmptyList.get(Collections.kt:23)
at me.ibrahimsn.lib.SmoothBottomBar.onDraw(SmoothBottomBar.kt:391)
at android.view.View.draw(View.java:23191)
at android.view.View.updateDisplayListIfDirty(View.java:22066)
at android.view.View.draw(View.java:22921)
at android.view.ViewGroup.drawChild(ViewGroup.java:5230)
at android.view.ViewGroup.dispatchDraw(ViewGroup.java:4987)
at android.view.View.draw(View.java:23194)
at android.view.View.updateDisplayListIfDirty(View.java:22066)
at android.view.View.draw(View.java:22921)
at android.view.ViewGroup.drawChild(ViewGroup.java:5230)
at android.view.ViewGroup.dispatchDraw(ViewGroup.java:4987)
at android.view.View.updateDisplayListIfDirty(View.java:22052)
at android.view.View.draw(View.java:22921)
at android.view.ViewGroup.drawChild(ViewGroup.java:5230)
at androidx.coordinatorlayout.widget.CoordinatorLayout.drawChild(CoordinatorLayout.java:1277)
at android.view.ViewGroup.dispatchDraw(ViewGroup.java:4987)
at android.view.View.draw(View.java:23194)
at android.view.View.updateDisplayListIfDirty(View.java:22066)
at android.view.View.draw(View.java:22921)
at android.view.ViewGroup.drawChild(ViewGroup.java:5230)
at androidx.drawerlayout.widget.DrawerLayout.drawChild(DrawerLayout.java:1426)
at android.view.ViewGroup.dispatchDraw(ViewGroup.java:4987)
at android.view.View.updateDisplayListIfDirty(View.java:22052)
at android.view.View.draw(View.java:22921)
at android.view.ViewGroup.drawChild(ViewGroup.java:5230)
at android.view.ViewGroup.dispatchDraw(ViewGroup.java:4987)
at android.view.View.updateDisplayListIfDirty(View.java:22052)
at android.view.View.draw(View.java:22921)
at android.view.ViewGroup.drawChild(ViewGroup.java:5230)
at android.view.ViewGroup.dispatchDraw(ViewGroup.java:4987)
at android.view.View.updateDisplayListIfDirty(View.java:22052)
at android.view.View.draw(View.java:22921)
at android.view.ViewGroup.drawChild(ViewGroup.java:5230)
at android.view.ViewGroup.dispatchDraw(ViewGroup.java:4987)
at android.view.View.updateDisplayListIfDirty(View.java:22052)
at android.view.View.draw(View.java:22921)
at android.view.ViewGroup.drawChild(ViewGroup.java:5230)
at android.view.ViewGroup.dispatchDraw(ViewGroup.java:4987)
at android.view.View.updateDisplayListIfDirty(View.java:22052)
at android.view.View.draw(View.java:22921)
at android.view.ViewGroup.drawChild(ViewGroup.java:5230)
at android.view.ViewGroup.dispatchDraw(ViewGroup.java:4987)
at android.view.View.draw(View.java:23194)
at com.android.internal.policy.DecorView.draw(DecorView.java:1117)
at android.view.View.updateDisplayListIfDirty(View.java:22066)
at android.view.ThreadedRenderer.updateViewTreeDisplayList(ThreadedRenderer.java:588)
at android.view.ThreadedRenderer.updateRootDisplayList(ThreadedRenderer.java:594)
at android.view.ThreadedRenderer.draw(ThreadedRenderer.java:667)
at android.view.ViewRootImpl.draw(ViewRootImpl.java:4267)
at android.view.ViewRootImpl.performDraw(ViewRootImpl.java:4051)
at android.view.ViewRootImpl.performTraversals(ViewRootImpl.java:3324)
at android.view.ViewRootImpl.doTraversal(ViewRootImpl.java:2204)
at android.view.ViewRootImpl$TraversalRunnable.run(ViewRootImpl.java:9003)
at android.view.Choreographer$CallbackRecord.run(Choreographer.java:996)
at android.view.Choreographer.doCallbacks(Choreographer.java:794)
at android.view.Choreographer.doFrame(Choreographer.java:729)
at android.view.Choreographer$FrameDisplayEventReceiver.run(Choreographer.java:981)
at android.os.Handler.handleCallback(Handler.java:883)
at android.os.Handler.dispatchMessage(Handler.java:100)
at android.os.Looper.loop(Looper.java:237)
at android.app.ActivityThread.main(ActivityThread.java:7860)
at java.lang.reflect.Method.invoke(Native Method)
at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:493)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:1075)

Badge option no found

How to add notification badge on Bottom Navigation View?

Usually we do this :

val navBar  = findViewById<BottomNavigationView>(R.id.bottom_navigation)
navBar.getOrCreateBadge(R.id.action_stamp).number = 2

Issue with NoActionbar theme

very cool !! lib.
i am using NoActionBar theme(i.e Theme.AppCompat.Light.NoActionBar / Theme.MaterialComponents.Light.NoActionBar) in this case fragment is not changing according to menu item. In DarkActionBar it works fine.

getActiveItem

Can you create a function for get active item like setActiveItem. Thanks

exposing iconMargin attribute

Well done, you've done a great work. I was using SmoothBottomBar in my mTodo and I needed to change the icon margin, but it was not exposed to xml attrs. I had to fork and increase the value inside Constnats.kt. It would be nice to have control over it dynamically. I will submit a pull request for that matter. Keep good work up ๐Ÿ‘Œ๐Ÿป
[PR: #36 ]

setOnItemSelectedListener not working in version 1.7.6

setOnItemSelectedListener or onItemSelectedListener not working in fragment
i'm getting unresolved reference.

i'm using it as
userType.setOnItemSelectedListener(object : OnItemSelectedListener{ override fun onItemSelect(pos: Int): Boolean { TODO("Not yet implemented") } })

Handling for title value in menu.xml

When you hardcode title value in bottom_menu.xml, it crashes the app because of resourse not found exception.
Please add the handling for reading hardcoded value in addition of reading from strings.xml.

Text Wrapping issue

Item name that has more than 6 character cant be expanded? what to do with that?

Show/Hide Bottom Navigation Bar

Currently I'm using animate();, if it gets a native show/hide option to be used along with the recycler view scroll behavior it might work more efficiently

Please help with this?

ERROR: Failed to resolve: com.github.ibrahimsn98:SmoothBottomBar:1.2
Show in Project Structure dialog
Affected Modules: app

Set up with viewPager ?

Anyway to set this bottom bar with a viewpager ? So that I can swipe back and forth between fragments ?

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.