android - 缺少样式。是否为此布局选择了正确的主题?

标签 android

Missing styles. Is the correct theme chosen for this layout? Use the Theme combo box above the layout to choose a different layout, or fix the theme style references. Failed to find style mapViewStyle in current theme.

我尝试了所有可用的解决方案来解决这个问题,但似乎没有任何效果。我已在 list 文件中包含库。我什至创建了样式是 styles.xml,我也选择了 Google APIs 构建目标。

有人可以给我一个解决方案吗?

这是我的 xml 文件:

<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
style="@style/AppTheme"
android:layout_width="fill_parent"
android:layout_height="fill_parent" >


 <com.google.android.maps.MapView
     android:id="@+id/themap"
     style="@style/mapViewStyle"
     android:layout_width="fill_parent"
     android:layout_height="fill_parent"
     android:apiKey="here i have my key"
     android:clickable="true"
     android:enabled="true" />

  </RelativeLayout>   

这是我的 list fragment :

  <uses-library android:name="com.google.android.maps" />

    <activity
        android:name=".MainActivity"
        android:label="@string/title_activity_main" >
        <intent-filter>
            <action android:name="android.intent.action.MAIN" />

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

    <activity android:name=".Third"  android:theme="@android:style/Theme.Black"/>
  </application>

这是我的 style.xml 文件

<resources>
    <style name="mapViewStyle" parent="@android:style/Theme.Black">
    </style>
</resources>

最佳答案

对于 Android Studio(或 IntelliJ IDEA),

如果您的项目中一切正常,但您的布局中仍然出现错误,请尝试“使缓存无效并重新启动”。

在 Android Studio 重新创建缓存和索引时喝杯咖啡。

how to invalidate cache & restart

关于android - 缺少样式。是否为此布局选择了正确的主题?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/13439486/

相关文章:

android - 使用 HttpURLConnection 请求 https

android - 奥利奥 : disable Activity transition animation

android - 在linux或android中获取文件/照片的物理内存地址

android - EditText 不会显示在 ListView 上方

java - View.gettag 返回 null,我在 ListView/ArrayAdapter 设置中错过了什么?

android - Android 组件中的对象创建

android - 如何使用 Retrofit 2 + OkHttp 3 加密/隐藏 HTTPS 调用的主体?

Android:内存不足错误

android - 在第一个对话框中单击按钮显示第二个对话框关闭第一个对话框

android - ScrollView内部的MotionLayout在状态改变后不更新高度