androidbottomnavigationviewandroid-bottomappbarandroid-bottomnavigationview

Customisation for Android BottomView


[![I want bottom bar like this][1]][1]

Using below library in android to customize bottom tab bar : https://github.com/Droppers/AnimatedBottomBar

It is quite easy to use and provide many animation. But, I don't want the menu text content to display in bottom bar.

I want only icons to display while it is selected or not selected.

How can I achieve with this library? Or Is there any way to acheive such thing?


Solution

  • I went through the library mentioned, it does not support this feature currently, but we can tweak the code to make it work for your usecase, but to do that you need to include the code as a module/folder instead instead of dependency.

    To achieve that, you need to follow below steps

    Once above steps are done, you can modify the code to your needs. Now for your use case, do replace updateTabType method present at line#99 inside library/src/main/java/nl/joery/animatedbottombar/TabView.kt file to below

    private fun updateTabType() {
        animatedView = icon_layout
        selectedAnimatedView = icon_layout //here we are forcing it use icon_layout for both views all the time
        if (selectedAnimatedView.visibility == View.VISIBLE) {
            animatedView.visibility = View.VISIBLE
            selectedAnimatedView.visibility = View.INVISIBLE
        } else {
            animatedView.visibility = View.INVISIBLE
            selectedAnimatedView.visibility = View.VISIBLE
        }
        bringViewsToFront()
    }
    

    Also the library is licensed under MIT Open Source License, so you can happily change your own version of code free of cost.

    Update

    Also, in library modules gradle, please remove references to bintray, that is not required

    apply plugin: 'com.android.library'
    apply plugin: 'kotlin-android'
    apply plugin: 'kotlin-android-extensions'
    
    android {
        compileSdkVersion 29
    
        defaultConfig {
            minSdkVersion 16
            targetSdkVersion 29
            versionCode 1
            versionName "1.0.9"
    
            testInstrumentationRunner 'androidx.test.runner.AndroidJUnitRunner'
            consumerProguardFiles 'consumer-rules.pro'
        }
    
        buildTypes {
            release {
                minifyEnabled false
                proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro'
            }
        }
    
        compileOptions {
            sourceCompatibility JavaVersion.VERSION_1_8
            targetCompatibility JavaVersion.VERSION_1_8
        }
    }
    
    dependencies {
        implementation fileTree(dir: 'libs', include: ['*.jar'])
        implementation "org.jetbrains.kotlin:kotlin-stdlib:1.3.61"
        implementation 'androidx.core:core-ktx:1.3.2'
        implementation 'androidx.appcompat:appcompat:1.2.0'
    
        implementation 'androidx.recyclerview:recyclerview:1.1.0'
        implementation 'androidx.viewpager2:viewpager2:1.0.0'
        implementation 'com.google.android:flexbox:2.0.1'
        implementation 'androidx.constraintlayout:constraintlayout:2.0.2'
    
        testImplementation 'junit:junit:4.12'
        androidTestImplementation 'androidx.test.ext:junit:1.1.2'
        androidTestImplementation 'androidx.test.espresso:espresso-core:3.3.0'
    
        implementation "androidx.navigation:navigation-ui-ktx:2.3.1"
    }