Warning: file_get_contents(/data/phpspider/zhask/data//catemap/3/android/190.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Android ActionBar不是';API 16中的t显示_Android_Android Actionbar - Fatal编程技术网

Android ActionBar不是';API 16中的t显示

Android ActionBar不是';API 16中的t显示,android,android-actionbar,Android,Android Actionbar,我是一个初学者,我在mainactivity中制作了一个包含导航抽屉和动作栏的应用程序。它在API 23上运行得很好,但在API 16中,动作栏没有显示。我搜索了“动作栏未显示”上的许多链接,但在API 11/8下它们出现了问题。在API 11之后,我认为AppCompat应该可以工作(我已经使用过) 这里是图片 这是我的styles.xml <resources> <!-- Base application theme. --> <style

我是一个初学者,我在mainactivity中制作了一个包含导航抽屉和动作栏的应用程序。它在API 23上运行得很好,但在API 16中,动作栏没有显示。我搜索了“动作栏未显示”上的许多链接,但在API 11/8下它们出现了问题。在API 11之后,我认为AppCompat应该可以工作(我已经使用过) 这里是图片

这是我的styles.xml

<resources>

    <!-- Base application theme. -->
    <style name="AppTheme" parent="Theme.AppCompat">
        <!-- 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.NoActionBar" parent="Theme.AppCompat.NoActionBar">
        <item name="windowNoTitle">true</item>
    </style>
    <style name="AppTheme.AppBarOverlay" parent="ThemeOverlay.AppCompat.Dark.ActionBar" />

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

</resources>

@颜色/原色
@颜色/原色暗
@颜色/颜色重音
真的
AndroidManifest.xml

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

    <uses-permission android:name="android.permission.INTERNET" />

    <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:label="@string/app_name"
            android:theme="@style/AppTheme.NoActionBar">
            <intent-filter>
                <action android:name="android.intent.action.MAIN" />

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

        <activity
            android:name=".RegistrationActivity"
            android:label="@string/title_activity_registration"
            android:theme="@style/AppTheme"></activity>
    </application>

</manifest>

首先,根据您的要求,请从清单中删除此行

android:theme="@style/AppTheme.NoActionBar"

我的建议是,使用工具栏而不是ActionBar

android:theme=“@style/AppTheme.NoActionBar”
为什么?使用工具栏我应该删除/添加什么代码才能正确实现工具栏?删除了那一行,情况仍然相同。我不知道如何实现工具栏。这些代码可能是在使用导航抽屉模板时自动生成的。好的,
首先它是预写的,没有父属性,然后,我尝试添加父项作为错误:“AndroidRuntime:致命异常:主java.lang.RuntimeException:无法启动活动组件信息{com.portus.yehchina/com.portus.yehchina.MainActivity}:java.lang.IllegalStateException:您需要使用一个Theme.AppCompat主题(或子代)有了这个活动poping@KamalVidhani首先,我提到了这一点。谢谢。我添加了缺少的工具栏小部件的xml编码。现在的问题是如何在工具栏上设置导航抽屉切换图标和按钮?