How to remove border around BottomNavigationView


Octavyanti Pilia Elvina Palopi

How can I remove the border in BottomNavigationView as shown below.

screenshot

My layout: bottom_nav_activity.xml

<?xml version="1.0" encoding="utf-8"?>
<androidx.coordinatorlayout.widget.CoordinatorLayout
xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="match_parent"
xmlns:tools="http://schemas.android.com/tools"
xmlns:app="http://schemas.android.com/apk/res-auto"
tools:context=".main.BottomNavigation">
<FrameLayout
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    android:id="@+id/frameContainer"
    app:layout_constraintBottom_toTopOf = "@id/bottomAppBar">
</FrameLayout>
<com.google.android.material.bottomappbar.BottomAppBar
    android:id="@+id/bottomAppBar"
    android:layout_width="match_parent"
    android:layout_height="wrap_content"
    app:fabCradleMargin="10dp"
    app:fabCradleVerticalOffset="10dp"
    app:fabCradleRoundedCornerRadius="20dp"
    android:layout_gravity="bottom">             
<com.google.android.material.bottomnavigation.BottomNavigationView
    android:id="@+id/bottomNavigationView"
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    app:menu="@menu/bottom_nav_menu"
    android:layout_marginEnd="16dp"
    app:popupTheme="@style/MyDarkToolbarStyle"
    app:backgroundTint="@android:color/transparent"/>
</com.google.android.material.bottomappbar.BottomAppBar>         
<com.google.android.material.floatingactionbutton.FloatingActionButton
    android:id="@+id/fab"
    android:layout_width="wrap_content"
    android:layout_height="wrap_content"
    android:backgroundTint="@color/white"
    android:src="@drawable/ic_explore"
    app:layout_anchor="@id/bottomAppBar" />
</androidx.coordinatorlayout.widget.CoordinatorLayout>

If I add background color to BottomAppbarresult is

Bottom app bar

Does anyone help me with this problem?

Zane

You can solve this problem in two steps:

Step 1: Create a drawable in the shape of a rectangle with a transparent color

res\drawable\transparent_rect.xml

<?xml version="1.0" encoding="utf-8"?>
<shape xmlns:android="http://schemas.android.com/apk/res/android"
    android:shape="rectangle" >
    <solid android:color="#00000000" />
</shape>

Step 2: Set the background of BottomNavigationViewthis drawable usingandroid:background

android:background="@drawable/transparent_rect"

Apply this to your layout:

<?xml version="1.0" encoding="utf-8"?>
<androidx.coordinatorlayout.widget.CoordinatorLayout
xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="match_parent"
xmlns:tools="http://schemas.android.com/tools"
xmlns:app="http://schemas.android.com/apk/res-auto"
tools:context=".main.BottomNavigation">

    <FrameLayout
        android:layout_width="match_parent"
        android:layout_height="match_parent"
        android:id="@+id/frameContainer"
        app:layout_constraintBottom_toTopOf = "@id/bottomAppBar">
    </FrameLayout>

    <com.google.android.material.bottomappbar.BottomAppBar
        android:id="@+id/bottomAppBar"
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        app:fabCradleMargin="10dp"
        app:fabCradleVerticalOffset="10dp"
        app:fabCradleRoundedCornerRadius="20dp"
        android:layout_gravity="bottom">     
            
        <com.google.android.material.bottomnavigation.BottomNavigationView
            android:id="@+id/bottomNavigationView"
            android:layout_width="match_parent"
            android:layout_height="match_parent"
            app:menu="@menu/bottom_nav_menu"
            android:layout_marginEnd="16dp"
            app:popupTheme="@style/MyDarkToolbarStyle"
            android:background="@drawable/transparent_rect"
            app:backgroundTint="@android:color/transparent"/>
    </com.google.android.material.bottomappbar.BottomAppBar>         

    <com.google.android.material.floatingactionbutton.FloatingActionButton
        android:id="@+id/fab"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:backgroundTint="@color/white"
        android:src="@drawable/ic_explore"
        app:layout_anchor="@id/bottomAppBar" />
    </androidx.coordinatorlayout.widget.CoordinatorLayout>

Preview:

enter image description here

Related


How to remove the image around the border

Edwin So I have a question. I used sprites for the first time and now borders appear around them, I tried setting border: none, but it didn't work. demo <div class="service"> <img href="image/icons.png" style="background-image:url('image/icons.png'); backgroun

How to remove the image around the border

Edwin So I have a question. I used sprites for the first time and now borders appear around them, I tried setting border: none, but it didn't work. demo <div class="service"> <img href="image/icons.png" style="background-image:url('image/icons.png'); backgroun

How to remove border around content editable emphasis?

Christopher: When I set the pre element as contenteditable and focus in it for editing, it receives a dashed border around it, which doesn't look great. When the focus is elsewhere, the border doesn't exist. How can I remove the border? thanks Marius: Set the

How to remove blue border around div

prick Would like to check what is the method I can use to remove the anonymous blue outline <div class="profile"> <a href="" data-toggle="modal" data-target="#myModal" style="border-width:none;"> <img class="img-circle" src="{{asset('images/user-profile

How can I remove the border around the toolbar?

Axl In my app I'm using the toolbar and it seems I want to get rid of the border around it: Then I create it like this: <android.support.design.widget.AppBarLayout android:layout_width="match_parent" android:layout_height="wrap_content" android:bac

How to remove border around content editable emphasis?

Christopher: When I set the pre element as contenteditable and focus in it for editing, it receives a dashed border around it, which doesn't look great. When the focus is elsewhere, the border doesn't exist. How can I remove the border? thanks Marius: Set the

How to remove border around UICollectionView in iOS?

technology chain I have created one UICollectionViewin the project . This is custom UICollectionViewCell. When I run the app, it's on UICollectionViewCell. A black border appears around it . Please tell me how to remove borders around custom cells? Jenn UIColl

How to remove blue border around div

prick Would like to check what is the method I can use to remove the anonymous blue outline <div class="profile"> <a href="" data-toggle="modal" data-target="#myModal" style="border-width:none;"> <img class="img-circle" src="{{asset('images/user-profile

How to remove blue border around div

prick Would like to check what is the method I can use to remove the anonymous blue outline <div class="profile"> <a href="" data-toggle="modal" data-target="#myModal" style="border-width:none;"> <img class="img-circle" src="{{asset('images/user-profile

How can I remove the border around the toolbar?

Axl In my app I'm using the toolbar and it seems I want to get rid of the border around it: Then I create it like this: <android.support.design.widget.AppBarLayout android:layout_width="match_parent" android:layout_height="wrap_content" android:bac

How to remove border around LineGraph in WPF?

Shubham Rokade How can I remove the border as shown in the picture? I'm trying to remove the border around the image and have tried some solutions BorderBrush="Transparent" BorderThickness="0"but they are not working. I just want to draw the graph in the windo

How to remove border around tinymce editor

username can someone help me Is it possible to remove borders from tinymce editor itself ? I wonder if this can be done with CSS. I've been googling and all I've found is removing borders from tables. Thanks in advance Taryama You can use the tinymce editor_cs

Strange border around arrow image, how to remove it?

principal fund I'm using slick sliders for our team carousel. There is a weird border around the arrow image to click on the next slide. I've tried removing all CSS that affects arrow images, google searches, stack overflow, etc. How can I remove this border?

How can I remove the border around the image?

username How can I remove the border around the square? Exterior: my HTML: <input id="black" type="image" src="html5-canvas-drawing-app/images/color-swatch-brown.png" onClick="changeColorBlack()"> my css: #black{ border:none; outline:none; background:none; pa

How to remove border around content editable emphasis?

Christopher: When I set the pre element as contenteditable and focus in it for editing, it receives a dashed border around it, which doesn't look great. When the focus is elsewhere, the border doesn't exist. How can I remove the border? thanks Marius: Set the

How to remove border around LineGraph in WPF?

Shubham Rokade How can I remove the border as shown in the picture? I'm trying to remove the border around the image and have tried some solutions BorderBrush="Transparent" BorderThickness="0"but they are not working. I just want to draw the graph in the windo

How to remove blue border around div

prick Would like to check what is the method I can use to remove the anonymous blue outline <div class="profile"> <a href="" data-toggle="modal" data-target="#myModal" style="border-width:none;"> <img class="img-circle" src="{{asset('images/user-profile

How to remove blue border around div

prick Would like to check what is the method I can use to remove the anonymous blue outline <div class="profile"> <a href="" data-toggle="modal" data-target="#myModal" style="border-width:none;"> <img class="img-circle" src="{{asset('images/user-profile

How can I remove the border around the toolbar?

Axl In my app I'm using the toolbar and it seems I want to get rid of the border around it: Then I create it like this: <android.support.design.widget.AppBarLayout android:layout_width="match_parent" android:layout_height="wrap_content" android:bac

Strange border around arrow image, how to remove it?

principal fund I'm using slick sliders for our team carousel. There is a weird border around the arrow image to click on the next slide. I've tried removing all CSS that affects arrow images, google searches, stack overflow, etc. How can I remove this border?

How to remove border around LineGraph in WPF?

Shubham Rokade How can I remove the border as shown in the picture? I'm trying to remove the border around the image and have tried some solutions BorderBrush="Transparent" BorderThickness="0"but they are not working. I just want to draw the graph in the windo

Strange border around arrow image, how to remove it?

principal fund I'm using slick sliders for our team carousel. There is a weird border around the arrow image to click on the next slide. I've tried removing all CSS that affects arrow images, google searches, stack overflow, etc. How can I remove this border?

How to remove border around LineGraph in WPF?

Shubham Rokade How can I remove the border as shown in the picture? I'm trying to remove the border around the image and have tried some solutions BorderBrush="Transparent" BorderThickness="0"but they are not working. I just want to draw the graph in the windo

How to remove border around tinymce editor

username can someone help me Is it possible to remove borders from tinymce editor itself ? I wonder if this can be done with CSS. I've been googling and all I've found is removing borders from tables. Thanks in advance Taryama You can use the tinymce editor_cs

remove border around dash

Formenti Matteo I want to remove the huge dotted border around the dash in Ubuntu 16.04. Google hasn't been my friend lately, I just can't find any results... Compizconfig doesn't contain any options for this. Can someone help me? More than There is no setting

remove border around dash

Formenti Matteo I want to remove the huge dotted border around the dash in Ubuntu 16.04. Google hasn't been my friend lately, I just can't find any results... Compizconfig doesn't contain any options for this. Can someone help me? More than There is no setting

Python - How to remove border around selected ListBox item?

David Harper It was a small problem, but I was struggling with it all afternoon and couldn't find anything, so went for it. I'm about to write a Python script that needs to use ScrolledListBox(). Never used it before, so I started with an experimental script,

How can I remove the light grey border around the Canvas widget?

Rectangle Rectangle: I've been messing around with Tkinter Canvaswidgets to see if I can make some nice looking widgets, and I have a few questions. First of all, why is there a light grey border around my Canvas widget and how do I get rid of it? Second, why