3

I keep trying to add a bottom navigation bar to my activity. However, it says that it Failed to find style 'bottomNavigationStyle' in current theme and The following classes could not be instantiated: - android.support.design.widget.BottomNavigationView. Am I doing something wrong?

I did implement the package in my build.gradle file:

implementation 'com.android.support:design:28.0.0-alpha3'

So, I don't think it is because of that...

enter image description here

<?xml version="1.0" encoding="utf-8"?>
<android.support.constraint.ConstraintLayout 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/container"
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    tools:context="com.pineapple.davinci.clubs.Activity_ClubsDashboard"
    tools:layout_editor_absoluteY="25dp">

    <android.support.design.widget.BottomNavigationView
        android:id="@+id/bottom_navigation"
        android:layout_width="match_parent"
        android:layout_height="40dp"
        android:layout_alignParentBottom="true"
        android:visibility="visible"
        app:itemIconTint="@drawable/nav_item_color_state"
        app:layout_constraintBottom_toBottomOf="parent"
        app:layout_constraintEnd_toEndOf="parent"
        app:layout_constraintStart_toStartOf="parent"
        app:menu="@menu/navigation" />

    <ScrollView
        android:id="@+id/scrollView2"
        android:layout_width="match_parent"
        android:layout_height="match_parent"
        app:layout_constraintBottom_toBottomOf="@+id/bottom_navigation"
        app:layout_constraintEnd_toEndOf="parent"
        app:layout_constraintStart_toStartOf="parent"
        app:layout_constraintTop_toTopOf="parent">

        <LinearLayout
            android:layout_width="match_parent"
            android:layout_height="wrap_content"
            android:orientation="vertical">

            <RelativeLayout
                android:layout_width="match_parent"
                android:layout_height="match_parent">

                <com.pineapple.davinci.clubs.ExpandableHeightGridView
                    android:id="@+id/gridview"
                    android:layout_width="wrap_content"
                    android:layout_height="wrap_content"
                    android:layout_alignParentBottom="true"
                    android:layout_below="@+id/clubs"
                    android:layout_centerHorizontal="true"
                    android:layout_marginTop="20dp"
                    android:columnWidth="160dp"
                    android:gravity="center"
                    android:horizontalSpacing="10dp"
                    android:isScrollContainer="false"
                    android:numColumns="auto_fit"
                    android:stretchMode="columnWidth"
                    android:verticalSpacing="14dp" />

                <ImageView
                    android:id="@+id/imageView6"
                    android:layout_width="62dp"
                    android:layout_height="38dp"
                    android:layout_alignParentStart="true"
                    android:layout_alignParentTop="true"
                    android:layout_marginStart="20dp"
                    android:layout_marginTop="30dp"
                    android:contentDescription="@drawable/gsmst_logo"
                    app:srcCompat="@drawable/gsmst_logo" />

                <ImageButton
                    android:id="@+id/imageButton3"
                    android:layout_width="wrap_content"
                    android:layout_height="wrap_content"
                    android:layout_alignParentEnd="true"
                    android:layout_alignParentTop="true"
                    android:layout_marginEnd="20dp"
                    android:layout_marginTop="37dp"
                    android:background="@android:color/transparent"
                    android:contentDescription="@drawable/icon_settings"
                    app:srcCompat="@drawable/icon_settings" />

                <TextView
                    android:id="@+id/clubs"
                    android:layout_width="175dp"
                    android:layout_height="40dp"
                    android:layout_alignStart="@+id/imageView6"
                    android:layout_below="@+id/imageView6"
                    android:text="@string/clubs"
                    android:textAppearance="@style/header_clubs"
                    tools:layout_editor_absoluteY="38dp" />

            </RelativeLayout>
        </LinearLayout>
    </ScrollView>

</android.support.constraint.ConstraintLayout>

Stackoverflow's telling me to write more text so I'm writing more text. It still wants me to add more text... There we go

joshua
  • 458
  • 5
  • 18

1 Answers1

0

it's a bug in support library, there are lots of bugs in release 28.0.0 and later versions, so I just put Base. before themes in parent attrib and it doesn't give me any error.


All you've got to do is change Theme.AppCompat.Light to Base.Theme.AppCompat.Light in your styles.xml file.

Eric Aya
  • 69,473
  • 35
  • 181
  • 253
The Badak
  • 2,010
  • 2
  • 16
  • 28