Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!

test

Problem adding BottomNavigationView in a Android WebView application

edited March 13 in Android

I really faced this problem of adding a BottomNavigationView in Android WebView application.The main reason is because the WebView occupies the whole i.e fill_parent.Luckily i managed to solve the problem just by using a simple code i added to my application code.
See below code.

`
<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout 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:layout_width="match_parent"
android:layout_height="match_parent"
tools:context="net.techoverload.www.mafisizone.MainActivity">


<android.support.v7.widget.Toolbar
    android:id="@+id/my_toolbar"
    android:layout_width="match_parent"
    android:layout_height="?attr/actionBarSize"
    android:background="@android:color/holo_blue_dark"
    android:theme="@style/ThemeOverlay.AppCompat.Dark.ActionBar"
    app:popupTheme="@style/ThemeOverlay.AppCompat.Light"

/>

<android.support.design.widget.BottomNavigationView
    android:id="@+id/main_nav"
    android:layout_alignParentBottom="true"
    android:layout_width="match_parent"

    android:layout_height="56dp"
    android:background="@android:color/holo_blue_dark"

    ></android.support.design.widget.BottomNavigationView>



    <WebView
        android:id="@+id/webView"
        android:layout_width="fill_parent"
        android:layout_height="fill_parent"
        android:layout_above="@id/main_nav"


        android:layout_below="@id/my_toolbar"></WebView>


`

The code that changed the whole thing is

android:layout_alignParentBottom="true"

That did wonders for me.

Sign In or Register to comment.