谷歌地图在Android中:无法找到风格'mapViewStyle“在当前主题 [英] Google Maps in Android: Failed to find style 'mapViewStyle' in current theme

查看:184
本文介绍了谷歌地图在Android中:无法找到风格'mapViewStyle“在当前主题的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

对不起球员,另外一个关于这个话题。我已阅读所有关于它的帖子,到目前为止,但至今没有一个答案摸索出适合我。我花了几个小时的努力,现在要解决这个问题,并开始拉我的头发之前,我想给它一个尝试此处。

Sorry guys, another one about this topic. I have read ALL the postings about it so far, but so far none of the answers worked out for me. I have spent hours on trying to fix that now and before starting to pull my hairs out, I'd like to give it another try here.

我的XML布局和图形布局之间切换时收到上述错误消息在Eclipse中。

I'm getting the above error message in Eclipse when switching between XML layout and graphical layout.

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

下面是我的布局XML文件:

Here is my layout XML file:

<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:orientation="vertical" >

<!-- Screen Design for the MAP Tab -->
<TextView
    android:id="@+id/vvm_offline"
    android:layout_width="fill_parent"
    android:layout_height="wrap_content"
    android:padding="15dip"
    android:text="You have to be online to display the map."
    android:textSize="18dip" />

<com.google.android.maps.MapView
    xmlns:android="http://schemas.android.com/apk/res/android"
    android:id="@+id/mapview"
    android:layout_width="fill_parent"
    android:layout_height="fill_parent"
    android:apiKey="xxx"
    android:clickable="true"
    android:state_enabled="true" />

<LinearLayout
    android:id="@+id/zoom"
    android:layout_width="wrap_content"
    android:layout_height="wrap_content" />

</LinearLayout>

在我的Andr​​oidManifest.xml中,一切似乎是理所应当根据其他提示我发现是:

In my AndroidManifest.xml, everything seems to be as it should be according to the other tips I've found:

<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.test.myapp"
android:versionCode="1"
android:versionName="0.1" >
<uses-sdk android:minSdkVersion="8" />

<uses-permission android:name="android.permission.ACCESS_COARSE_LOCATION" />
<uses-permission android:name="android.permission.ACCESS_FINE_LOCATION" />
<uses-permission android:name="android.permission.INTERNET" >
</uses-permission>
<uses-permission android:name="android.permission.ACCESS_MOCK_LOCATION" />
<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" />

<application
    android:allowBackup="true"
    android:label="@string/app_name" >
    <uses-library
        android:name="com.google.android.maps"
        android:required="true" />

    <activity
        android:name=".myappActivity"
        android:label="@string/app_name"
        android:theme="@android:style/Theme.NoTitleBar" >
    (etc.)

    <activity
        android:name=".ViewMapActivity"
        android:label="View Map" >
    </activity>
    (etc.)

顺便说一句,这都没有区别是否我已经在安卓定义的主题:主题或不

By the way, it makes no difference whether I have defined the 'theme' in android:theme or not.

任何想法如何解决这个问题?我可以编译和运行应用程序,却得到了一个N​​ullPointerException异常创建视图的时候。

Any ideas how to fix this error? I can compile and run the app, but get a NullPointerException when the view is created.

推荐答案

这对我来说太..进入水库>值> styles.xml

This happened to me too.. go into res>values>styles.xml

删除previous主题线路,并把这个

remove the previous theme line and put this one

<style name="AppBaseTheme" parent="android:Theme.Light">

在项目创建过程中,Eclipse询问确定一个主题为应用程序。您可能选择任何的Holo主题。这个主题不支持图形页面这是显示错误。

The eclipse during the project creation asks to define a theme for the application. You might have selected any Holo theme. This theme doesn't support MapView which is showing the error.

这篇关于谷歌地图在Android中:无法找到风格'mapViewStyle“在当前主题的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
相关文章
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆