Android错误 - 无法找到样式&toolbarStyle'在当前主题

时间:2016-08-12 12:25:07

标签: android android-layout android-studio material-design

我是Android编程的新手。目前正在关注一系列YouTube视频(https://www.youtube.com/watch?v=Bzh9P1z1l90&list=PLshdtb5UWjSoLy2LPP1FsHi1hwoAS4SBi&index=7),以了解如何使用Material Design。

我现在只是停留在一点。我收到这样的错误..

enter image description here

我也在谷歌搜索,但没有得到任何可靠的答案。这是我的所有文件。

styles.xml     

def tree(self):
    if self.pk is None and self.isA:
        event = Event.objects.create(name="Event", rank="A", owner=self.user)
        subEvent = Event.objects.create(name="Sub Event", rank="AA", owner=self.user, parent=event)

V21 / styles.xml

    <!-- 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>
    </style>

    <style name="BhramaanTheme" parent="AppTheme"></style>

</resources>

activity_login.xml

<?xml version="1.0" encoding="utf-8"?>
<resources>
    <style name="BhramaanTheme" parent="AppTheme">
        <item name="android:windowBackground">@color/windowBackground</item>
        <item name="android:navigationBarColor">@color/navigationBarColor</item>
    </style>
</resources>

tool_bar.xml

<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
    xmlns:tools="http://schemas.android.com/tools"
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    tools:context="com.bhramaan.android.bhramaan.LoginActivity">

    <include
        android:id="@+id/toolbar"
        layout="@layout/tool_bar"
        />

    <TextView
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:layout_below="@id/toolbar"
        android:text="Hello World!" />
</RelativeLayout>

AndroidMainfest.xml

<?xml version="1.0" encoding="utf-8"?>
<android.support.v7.widget.Toolbar xmlns:android="http://schemas.android.com/apk/res/android"
    android:layout_width="match_parent" android:layout_height="wrap_content"
    android:background="@color/colorPrimary"
    android:elevation="4dp"
    android:theme="@style/ThemeOverlay.AppCompat.Dark"
    >

</android.support.v7.widget.Toolbar>

LoginActivity.java

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

    <application
        android:allowBackup="true"
        android:icon="@mipmap/ic_launcher"
        android:label="@string/app_name"
        android:supportsRtl="true"
        android:theme="@style/AppTheme">
        <activity android:name=".LoginActivity">
            <intent-filter>
                <action android:name="android.intent.action.MAIN" />

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

</manifest>

任何人都可以帮助我理解我在这里做错了什么?

此致

1 个答案:

答案 0 :(得分:0)

替换以下代码

<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android" 
          package="com.bhramaan.android.bhramaan">
    <application
        android:allowBackup="true" 
        android:icon="@mipmap/ic_launcher" 
        android:label="@string/app_name" 
        android:supportsRtl="true" 
        android:theme="@style/BhramaanTheme"> 
        <activity android:name=".LoginActivity"> 
            <intent-filter> 
                <action android:name="android.intent.action.MAIN" /> 
                <category android:name="android.intent.category.LAUNCHER" />
            </intent-filter> 
        </activity> 
    </application> 
</manifest>