我是android开发新手,正在开发一个溢出菜单。为此,我必须更改我的应用程序的主题,以便包含溢出菜单的操作栏可见。Android Studio渲染问题:缺失顶栏
但是android studio没有使用操作栏来渲染任何主题。
我搜索了互联网的解决方案,发现一个在stackoverflow上说我不得不更新我的res/values/styles.xml文件。我更新了名为AppTheme的标签,但它并未解决我的问题。
我试图使缓存无效并重新启动,但仍未解决。我也试图清理这个项目并重建它。没有工作。
我附上错误的截图。 请帮助。
这里是我的styles.xml文件:
<resources>
<!-- Base application theme. -->
<style name="AppTheme" parent="Base.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.NoActionBar">
<item name="windowActionBar">false</item>
<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.example.naveenjain.test3">
<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>
</application>
</manifest>
添加styles.xml –
添加您的AndroidManifest.xml – piotrek1543
问题就解决了,当我选择空活动,而不是空活动,但随后我无法创建溢出菜单。 请帮忙!! – Ayusch