Gowtham Subramaniam
Gowtham Subramaniam

Reputation: 3478

No resource found that matches the given name (at 'theme' with value '@style/AppTheme.AppBarOverlay')

Some issue in this program. I don't know what is the problem.

<?xml version="1.0" encoding="utf-8"?>
<android.support.design.widget.CoordinatorLayout 
     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"
     android:fitsSystemWindows="true"
     tools:context="com.example.bharathi.r_box.MainActivity">

    <android.support.design.widget.AppBarLayout
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:theme="@style/AppTheme.AppBarOverlay"/>

    <android.support.v7.widget.Toolbar
        android:id="@+id/toolbar"
        android:layout_width="match_parent"
        android:layout_height="?attr/actionBarSize"
        android:background="?attr/colorPrimary"
        app:popupTheme="@style/AlertDialog.AppCompat.Light" >

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

    <include layout="@layout/content_main" />

    <android.support.design.widget.FloatingActionButton
        android:id="@+id/fab"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:layout_gravity="bottom|end"
        android:layout_margin="@dimen/activity_horizontal_margin"
        android:src="@android:drawable/ic_dialog_email" />

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

Can anyone explain whats the problem in this?

Upvotes: 14

Views: 37197

Answers (4)

s.j
s.j

Reputation: 651

you need to add in style class like this :

  <style name="AppTheme" parent="Theme.AppCompat.Light.DarkActionBar">
        <!-- 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="AppTheme.AppBarOverlay" parent="ThemeOverlay.AppCompat.Dark.ActionBar">
        <item name="android:textColorPrimary">TITLE_COLOR_GOES_HERE</item>
        <item name="android:textColorSecondary">SUBTITLE_COLOR_GOES_HERE</item>
    </style>

    <style name="AppTheme.PopupOverlay" parent="ThemeOverlay.AppCompat.Light" />

Upvotes: 13

Gowtham Subramaniam
Gowtham Subramaniam

Reputation: 3478

I had fixed this issue by changing

styles.xml

Change

android:theme="@style/AppTheme"

To

android:theme="@style/AppBaseTheme"

Upvotes: 3

Rucsi
Rucsi

Reputation: 290

I found this here http://developer.android.com/guide/topics/ui/themes.html ,maybe it helps.

A style is a collection of properties that specify the look and format for a View or window
A theme is a style applied to an entire Activity or application, rather than an individual View

As AppBarLayout is a view, maybe using style instead would help.

Upvotes: 2

Chris Sherlock
Chris Sherlock

Reputation: 941

You need to create these theme e.g.

<style name="AppTheme.AppBarOverlay" parent="ThemeOverlay.AppCompat.Dark.ActionBar">
        <item name="android:textColorPrimary">TITLE_COLOR_GOES_HERE</item>
        <item name="android:textColorSecondary">SUBTITLE_COLOR_GOES_HERE</item>
</style>

Upvotes: 18

Related Questions