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

0

I'm having this problem when I run my app on an android 4.4. I've been looking for solutions all day, but nothing works and I can not find any errors in my code. Thanks in advance for any help!

style.xml:

<resources><stylename="AppTheme" parent="Theme.AppCompat.Light.DarkActionBar">
    <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" />

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

v21 \ style.xml:

<resources>
<style name="AppTheme.NoActionBar">
    <item name="windowActionBar">false</item>
    <item name="windowNoTitle">true</item>

    <!--<item name="android:windowDrawsSystemBarBackgrounds">true</item>-->
    <!--faz o drawer aparecer por baixo do status-->
    <!--<item name="android:statusBarColor">@android:color/transparent</item>-->

    <item name="android:dialogTheme">@style/AppTheme.DialogStyle</item>
    <item name="android:alertDialogTheme">@style/AppTheme.DialogStyle</item>

    <item name="windowActionModeOverlay">true</item>
    <item name="windowActionBarOverlay">true</item>
</style>

<style name="AppTheme.DialogStyle" parent="Theme.AppCompat.Light.Dialog">
    <item name="android:colorAccent">@color/colorAccent</item>
</style>

Manifest:

<application
    android:allowBackup="false"
    android:icon="@mipmap/ic_launcher"
    android:label="@string/app_name"
    android:supportsRtl="false"
    android:theme="@style/AppTheme"

    <activity
        android:name=".controller.activitys.MainActivity"
        android:label="@string/app_name"
        android:launchMode="singleTask"
        android:theme="@style/AppTheme.NoActionBar"
        android:screenOrientation="portrait">
        <intent-filter>
            <action android:name="android.intent.action.MAIN" />

            <category android:name="android.intent.category.LAUNCHER" />
        </intent-filter>
    </activity>...
    
asked by anonymous 06.03.2017 / 18:48

1 answer

0

In the Place of:

<activity
        android:name=".controller.activitys.MainActivity"
        android:label="@string/app_name"
        android:launchMode="singleTask"
        android:theme="@style/AppTheme.NoActionBar"

You should put:

<activity
        android:name=".controller.activitys.MainActivity"
        android:label="@string/app_name"
        android:launchMode="singleTask"
        android:theme="@style/Theme.AppCompat"

Then you take ActionBar via code if you prefer.

    
06.03.2017 / 19:49