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 重新创建缓存和索引时喝杯咖啡。
关于android - 缺少样式。是否为此布局选择了正确的主题?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/13439486/