缺少风格.是否为此布局选择了正确的主题?使用布局上方的主题组合框选择不同的布局,或修复主题样式引用.无法
mapViewStyle在当前主题中找到样式.
我尝试了所有可用的解决方案来解决这个问题但似乎没有任何效果.我在清单文件中包含了库.我甚至创建了样式是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>
Run Code Online (Sandbox Code Playgroud)
这是我的清单片段:
<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>
Run Code Online (Sandbox Code Playgroud)
这是我的style.xml文件
<resources>
<style name="mapViewStyle" parent="@android:style/Theme.Black">
</style>
</resources>
Run Code Online (Sandbox Code Playgroud)
gbe*_*ero 151
对于Android Studio(或IntelliJ IDEA),
如果项目中的所有内容都正常,并且您仍然在布局中收到错误,请尝试"使缓存无效并重新启动".
在Android Studio重新创建缓存和索引时享用咖啡.

小智 150
我有同样的问题,发现它是图形布局编辑器顶部的主题下拉列表.我从Holo更改为Theme,显示的布局和错误消失了.
Hen*_*Zhu 14
我通常做的是以下几点:a Gradle Clean,Rebuild和Sync all my Gradle files.之后我是restart Android Studio,我去了:
Select Theme -> Project Themes -> AppTheme
Run Code Online (Sandbox Code Playgroud)
| 归档时间: |
|
| 查看次数: |
197212 次 |
| 最近记录: |