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

Aja*_*jay 6 xml android google-maps

我试图在我的应用程序中使用地图,我收到此错误,无法在当前主题中找到样式'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 Auto-generated method stub
        return false;
    }
}
Run Code Online (Sandbox Code Playgroud)

请帮帮我...谢谢.

Kar*_*amy 6

我的答案可能是迟到的,但我希望它能解决实际原因,并确保它可能对那些将来会搜索同一问题的人有所帮助.

这种错误,

1. Android Google Maps Failed to find style 'mapViewStyle' in current theme
2. Failed to find style 'imageButtonStyle' in current theme 
3. Failed to find style 'editTextStyle' in current theme 
4. Failed to find style 'textViewStyle' in current theme 
Run Code Online (Sandbox Code Playgroud)

它可能是以上列表中的任何内容,

最终的原因是,

我们选择了不可用Themelayout.

出现这种情况可能是由于以下原因:

  1. 所选theme内容在themes.xml文件中不可用.
  2. 所选theme的属于更高版本sdk,但我们当前的目标sdk是较低的版本.

这个问题大多发生,

  1. 当你复制整个layout文件并尝试在你的文件中实现它project.一个.您可能忘记复制themes.xml文件b.您可能有较低的target sdk,原始layout创建更高target sdk.

这个问题的解决方案是,

(打开查看layout在文件中Graphical Layout View,并期待在右上角有你themeslayout已经被选中.)

  1. 所以点击下拉列表theme选项,并选择可用的themes根据项目themestargeted sdk themes. (要么)
  2. 如果themecustom一个,如果您需要它,则将themes.xml文件从您复制layout xml文件的源复制到项目中. (要么)
  3. 如果themesdk无济于事theme,如果你需要它,那么你改变target根据您的选择theme.

希望 - 这可能对某人有帮助.