0

I have a class that extends the AppCompatActivity class, inside that I'm building a layout for which I would like to apply a style.

I'm getting the same error message as seen here:

You need to use a Theme.AppCompat theme (or descendant) with this activity

java.lang.IllegalStateException: You need to use a Theme.AppCompat theme (or descendant) with this activity

This is what I was using before I switched to AppCompatActivity from simply Activity.

    android:theme="@android:style/Theme.NoTitleBar.Fullscreen">

With this new class I just cannot access Theme.AppCompat as others were able to, just nothing comes up I could use.

enter image description here

I read the whole page and the official declarations but I cannot figure out why I cannot access the AppCompat styles as seen here in my AndroidManifest.xml above.

Hydraxia
  • 81
  • 2
  • 9
  • 1
    Themes that are not part of the framework (your custom themes, AppCompat) don't have the `android:` prefix. – Eugen Pechanec Mar 10 '19 at 12:19
  • Hi, I tried declaring the style without the prefix but then I get the error message "Attribute is missing the Android namespace prefix", because in my manifest I have the code "xmlns:android="http://schemas.android.com/apk/res/android". Do you think there is another way to solve this? The Android manifest xml has to use the Android prefix right? – Hydraxia Mar 10 '19 at 12:24
  • My mistake, `android:theme="@style/..."`. the atrribute has the prefix, the style reference doesn't. The default AppCompat theme is `Theme.AppCompat`, you wouldn't find it by typing `AppThe`. – Eugen Pechanec Mar 10 '19 at 12:30

0 Answers0