渲染问题无法在当前主题中找到样式“ bottomNavigationStyle”

时间:2018-09-01 11:20:52

标签: android android-layout bottomnavigationview

我有一个版面,里面是BottomNavigationView,该版面可以识别我BottomNavigationView,但是却给我一个错误:无法在当前主题中找到样式'bottomNavigationStyle'

和警告: 缺少样式。是否为此布局选择了正确的主题? 使用布局上方的“主题”组合框选择不同的网络布局,或修复主题样式引用。

我已经提供了刷新按钮,但是它没有进行任何更改

这是我的布局代码:

<?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=".Principal_Activity"
    android:background="#FFFFFF">



 <include
        android:id="@+id/toolbar"
        layout="@layout/tool_bar"
        android:layout_width="match_parent"
        android:layout_height="wrap_content" />


    <LinearLayout
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:layout_alignParentTop="true"
        android:orientation="vertical"
        android:paddingTop="60dp">

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

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

            </LinearLayout>
        </ScrollView>

    </LinearLayout>



    <android.support.design.widget.BottomNavigationView
        xmlns:android="http://schemas.android.com/apk/res/android"
        xmlns:design="http://schemas.android.com/apk/res-auto"
        xmlns:tools="http://schemas.android.com/tools"
        android:id="@+id/bottomNavigationView"
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:layout_alignParentBottom="true"
        android:background="#1565c0"
        design:menu="@menu/menu_updown"
        tools:context=".Principal_Activity" >

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




</RelativeLayout>

菜单布局:

<?xml version="1.0" encoding="utf-8"?>
<menu xmlns:android="http://schemas.android.com/apk/res/android">

    <item
        android:id="@+id/inicioItem"
        android:icon="@drawable/home"
        android:title="@string/home" />



    <item
        android:id="@+id/camaraItem"
        android:icon="@drawable/add"
        android:title="@string/camera" />



    <item
        android:id="@+id/mapItem"
        android:icon="@drawable/logo_map"
        android:title="@string/map" />

</menu>

清单:

<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
    package="com.example.julio.photogo">
    <uses-permission
        android:name="android.permission.GET_ACCOUNTS"
        android:maxSdkVersion="22"/>
        <uses-permission android:name="android.permission.INTERNET"/>
    <uses-permission android:name="android.permission.READ_EXTERNAL_STORAGE" />
    <uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" />
    <uses-permission android:name="android.permission.CAMERA" />

    <application

        android:name=".LogApp"
        android:allowBackup="true"
        android:icon="@mipmap/ic_launcher"
        android:hardwareAccelerated="false"
        android:label="@string/app_name"
        android:roundIcon="@mipmap/ic_launcher_round"
        android:supportsRtl="true"
        android:theme="@style/Theme.AppCompat.NoActionBar"
        >
        <meta-data android:name="com.facebook.sdk.ApplicationId"
            android:value="@string/facebook_app_id"/>
        <meta-data
            android:name="preloaded_fonts"
            android:resource="@array/preloaded_fonts" />

        <activity android:name="com.facebook.FacebookActivity"
            android:configChanges="keyboard|keyboardHidden|screenLayout|screenSize|orientation"
            android:label="@string/app_name" />
        <activity
            android:name="com.facebook.CustomTabActivity"
            android:exported="true">
            <intent-filter>
                <action android:name="android.intent.action.VIEW" />
                <category android:name="android.intent.category.DEFAULT" />
                <category android:name="android.intent.category.BROWSABLE" />
                <data android:scheme="@string/fb_login_protocol_scheme" />
            </intent-filter>
        </activity>

        <activity
            android:name=".Main_Activity"
            android:label="@string/app_name" >

            <intent-filter>
                <action android:name="android.intent.action.MAIN" />
                <category android:name="android.intent.category.LAUNCHER" />
            </intent-filter>
        </activity>

        <activity android:name=".Register_Activity"></activity>

        <activity android:name=".SingIn_Activity"></activity>

        <activity android:name=".Principal_Activity"></activity>

        <activity android:name=".Camera_Activity"></activity>

        <provider
            android:name="android.support.v4.content.FileProvider"
            android:authorities="${applicationId}.provider"
            android:exported="false"
            android:grantUriPermissions="true">
            <meta-data
                android:name="android.support.FILE_PROVIDER_PATHS"
                android:resource="@xml/provider_paths"/>
        </provider>

    </application>

</manifest>

Styles.xml

<resources>

    <!-- Base application theme. -->
    <style name="AppTheme" parent="Theme.AppCompat.Light.NoActionBar">
        <!-- Customize your theme here. -->
        <item name="colorPrimary">@color/colorPrimary</item>
        <item name="colorPrimaryDark">@color/colorPrimaryDark</item>
        <item name="colorAccent">@color/colorAccent</item>
        <item name="windowActionBar">false</item>
        <item name="windowNoTitle">true</item>
    </style>

</resources>

2 个答案:

答案 0 :(得分:0)

我也有同样的问题。受到以下答案的启发:https://stackoverflow.com/a/49305312/7061548我找到了解决此问题的方法。

在您的styles.xml文件中添加以下内容:

var factory = new ItemFactory();
var items = new List<IItem>();
for (int i = 0; i < parts.Length; i++)
{
    items.Add(factory.CreateItem(i, parts[i]));
}
// do whatever you wants

答案 1 :(得分:0)

显然这是28.0.0中的错误-参见Java-主题错误-如何解决?在这里重现该解决方案... 将以下内容添加到build.gradle中,以强制其使用27.0.0

configurations.all {
        resolutionStrategy.eachDependency { DependencyResolveDetails details ->
            def requested = details.requested
            if (requested.group == "com.android.support") {
                if (!requested.name.startsWith("multidex")) {
                    details.useVersion "27.1.1"
                }
            }
        }
    }