Android hides the action bar and toolbar

In the list I use

minSdkVersion 14
targetSdkVersion 23

Now, I want to hide the theme:

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

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

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

</manifest>


<resources>

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

</resources>

But I got this mistake:

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

resolvent:

Simply replace with:

< style name =“ AppTheme” parent =“ @ style / Theme.AppCompat.Light”>

With this:

< style name =“ AppTheme” parent =“ Theme.AppCompat.Light.NoActionBar”>

If you want to hide the toolbar after the setsupportactionbar (toolbar toolbar) method, use getsupportactionbar(). Hide()

Hope to help you!!!

The content of this article comes from the network collection of netizens. It is used as a learning reference. The copyright belongs to the original author.
THE END
分享
二维码
< <上一篇
下一篇>>