相关疑难解决方法(0)

无法在当前主题中找到样式'mapViewStyle'

我正在制作一个使用谷歌地图的应用程序.但是在我的xml中,我得到了错误"在当前主题中找不到样式'mapViewStyle'." 相反,我给了onternet权限,并在应用程序标记内使用了谷歌地图库.

任何人都可以帮助我.

非常感谢

以下是我的xml文件...

    <?xml version="1.0" encoding="utf-8"?>
    <RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
        android:orientation="vertical"
        android:layout_width="fill_parent"
        android:layout_height="fill_parent"
        >
    <TextView  
        android:layout_width="fill_parent" 
        android:layout_height="wrap_content" 
        android:text="@string/hello"
        />
  <com.google.android.maps.MapView
    android:id="@+id/mapview1"
    android:layout_width="fill_parent"
    android:layout_height="fill_parent"
    android:enabled="true"
    android:clickable="true"
    android:apiKey="0ACHOtlugQlOP_-siR3LLyIBjv1SwpKWimIY8jw" />
</Relativelayout>
Run Code Online (Sandbox Code Playgroud)

maps android

24
推荐指数
1
解决办法
4万
查看次数

'找不到样式mapViewStyle'错误仍然存​​在

我刚刚决定在几天前休息时,我已经在这个应用程序上工作了近一年(高级项目).我的应用程序是使用我的Windows 7 64位PC使用Eclipse版3.7.2 64bit定位Froyo Android 2.2开发的.到目前为止,我尝试过:

  • 重新排列清单文件中的uses-library标记
  • 重写map xml文件
  • 删除R.java文件并刷新
  • 将mapview元素放在布局中
  • 重新安装eclipse和android-sdk
  • 清理项目
  • 创建style.xml文件并引用它
  • 在实际设备上部署
  • 恢复到以前的代码

可能更多......

我的代码如下:gmap.xml

<?xml version="1.0" encoding="utf-8"?>
<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:clickable="true"
android:apiKey="0xMbgnc-el963gCdpl547hdkgXUILTskZr-T5uvg" // random key posted here
/>
Run Code Online (Sandbox Code Playgroud)

AndroidManifest.xml中

<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
  package="com.PubMe"
  android:versionCode="1"
  android:versionName="1.0">

<uses-permission android:name="android.permission.INTERNET" />
<uses-permission android:name="android.permission.ACCESS_FINE_LOCATION" />
<uses-sdk android:minSdkVersion="8"/>


<application android:icon="@drawable/icon" android:label="@string/app_name">
    <uses-library android:name="com.google.android.maps" />
    <activity android:name=".PubMeActivity"
              android:label="@string/app_name"
              android:screenOrientation="portrait">
        <intent-filter>
            <action android:name="android.intent.action.MAIN" />
            <category android:name="android.intent.category.LAUNCHER" />
        </intent-filter>
    </activity>
    <activity android:name=".MappingActivity"
              android:label="@string/app_name">
    </activity>

</application>
</manifest>
Run Code Online (Sandbox Code Playgroud)

我非常感谢任何提前帮助.

java eclipse android google-maps android-xml

24
推荐指数
1
解决办法
1725
查看次数

让我们解决"当前主题中找不到风格'mapViewstyle'的错误"

很抱歉发布另外一个,但似乎我们还没有记录这个问题的每个解决方案.

这是发生了什么:我添加了mapview,一切都在工作.我添加了一个滑动抽屉并将按钮移入其中,然后将根节点从线性更改为相对.从那时起,我在读取的main.xml类的图形布局中出现错误

缺少风格.是否为此布局选择了正确的主题?使用布局上方的主题组合框选择不同的布局,或修复主题样式引用.无法在当前主题中找到样式'mapViewStyle'.

将根节点切换为线性并返回到相对位置已使地图显示,但错误仍在图形布局中.

到目前为止,我已经完成了以下解决方案,可以解决大多数情况下的问题:

  1. 添加了style.xml以创建"mapView"样式.
  2. 验证我的构建目标是API 2.3.3(10)
  3. 确保<uses-library android:name="com.google.android.maps"/>是Application的子节点.
  4. 清理/重建我的应用程序.
  5. 删除了R.
  6. 删除并重建了main.xml
  7. 重新启动了adb服务器,Eclipse,我的计算机和我的设备.
  8. 在图形布局中,在Android 3.0和Android 2.3.3之间切换.

但是,我的问题仍然存在.这是我的布局xml.

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


<com.google.android.maps.MapView
    xmlns:android="http://schemas.android.com/apk/res/android"
    android:id="@+id/mapview"
    style="@style/mapView"
    android:layout_width="fill_parent"
    android:layout_height="fill_parent"
    android:layout_alignParentBottom="true"
    android:layout_alignParentLeft="true"
    android:layout_alignParentTop="true"
    android:apiKey="asdf" //not my real key
    android:clickable="true" />

<!-- TODO: update the API key with release signature -->
<SlidingDrawer
    android:id="@+id/slidingDrawer1"
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    android:content="@+id/content"
    android:handle="@+id/handle" >

    <Button
        android:id="@+id/handle"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:text="@string/Menu" />


    <LinearLayout
        android:id="@+id/content"
        android:layout_width="match_parent"
        android:layout_height="match_parent" >

        <Button
            android:id="@+id/about"
            android:layout_width="fill_parent"
            android:layout_height="wrap_content"
            android:text="@string/about" /> …
Run Code Online (Sandbox Code Playgroud)

eclipse android android-layout android-mapview

21
推荐指数
1
解决办法
3万
查看次数

Android Google Maps无法在当前主题中找到样式'mapViewStyle'

添加谷歌地图视图时(我扩展了MapView,使用xml编辑器将其添加到活动中,并手动将我的谷歌地图api键添加到布局xml文件中)

我的权限允许清单文件中的Internet

我想知道的是,在xml编辑器中我得到错误"在当前主题中找不到样式'mapViewStyle'"但我似乎已经正确设置了所有内容.

java android google-maps

20
推荐指数
1
解决办法
2万
查看次数

Android - 无法在当前主题中找到样式'mapViewStyle'

我的Android地图应用程序有点问题.因此,当我将MapView添加到我的布局xml文件时,它向我显示"在当前主题中找不到样式'mapViewStyle'"错误消息.

这是我的AndroidManifest.xml:

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

    <application android:icon="@drawable/icon" android:label="@string/app_name">

    <uses-library android:name="com.google.android.maps"/>
        <activity android:name=".AcilActivity"
                  android:label="@string/app_name">
            <intent-filter>
                <action android:name="android.intent.action.MAIN" />
                <category android:name="android.intent.category.LAUNCHER" />
            </intent-filter>
        </activity>

    </application>

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

</manifest>
Run Code Online (Sandbox Code Playgroud)

和出现该错误消息的main.xml:

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

   <com.google.android.maps.MapView
    android:id="@+id/myMapView"
    android:layout_width="fill_parent"
    android:layout_height="fill_parent"
    android:enabled="true"
    android:clickable="true"
    android:apiKey="*******"
  />

</LinearLayout>
Run Code Online (Sandbox Code Playgroud)

注意:我已经检查了我的Google Maps api密钥,api密钥没有问题.

有什么建议?

android google-maps

7
推荐指数
1
解决办法
1万
查看次数

Android地图:无法在当前主题中找到样式"mapViewStyle"

我试图在我的应用程序中使用地图,我收到此错误,无法在当前主题中找到样式'mapViewStyle'

我已正确生成密钥,并已尝试在其他地方为同一问题提供的所有解决方案.

1.my target api and the one mentioned in the manifest file are the same.
2.There is no import.R in my project
3.I have cleaned my project.
4.Uses-library element is a child of the application.
Run Code Online (Sandbox Code Playgroud)

这是我的xml文件

<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    android:orientation="vertical" >

    <com.google.android.maps.MapView
        android:id="@+id/mapview1"
        android:layout_width="match_parent"
        android:layout_height="match_parent"
        android:clickable="true"
        android:apiKey="*****************" 
        android:enabled="true"
        />

</LinearLayout>
Run Code Online (Sandbox Code Playgroud)

这是我对应的java文件

package com.epidemicator.prototype;

import android.os.Bundle;
import com.google.android.maps.MapActivity;

public class Mapacti extends MapActivity {

    public void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.mapview);
    }

    @Override
    protected boolean isRouteDisplayed() {
        // TODO …
Run Code Online (Sandbox Code Playgroud)

xml android google-maps

6
推荐指数
1
解决办法
3423
查看次数