3

我一直在尝试为我的活动添加一个底部导航栏。但是,它说它Failed to find style 'bottomNavigationStyle' in current themeThe following classes could not be instantiated: - android.support.design.widget.BottomNavigationView. 难道我做错了什么?

我确实在我的 build.gradle 文件中实现了这个包:

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

所以,我觉得不是因为这个……

在此处输入图像描述

<?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 告诉我要写更多的文字,所以我要写更多的文字。它仍然希望我添加更多文本......我们开始

4

1 回答 1

0

这是支持库中的错误,发布28.0.0和更高版本中有很多错误,所以我只是将Base.主题放在父属性中的主题之前,它不会给我任何错误。


您所要做的就是更改Theme.AppCompat.LightBase.Theme.AppCompat.Lightstyles.xml文件。

于 2018-11-05T06:21:32.460 回答