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

ric*_*hey 8 android google-maps android-layout

对不起家伙,另一个关于这个话题.到目前为止,我已经阅读了有关它的所有帖子,但到目前为止,没有一个答案适合我.我已经花了好几个小时试图解决这个问题,现在开始拉开我的头发,我想在这里再试一次.

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

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
Run Code Online (Sandbox Code Playgroud)

这是我的布局XML文件:

<?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>
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.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.)
Run Code Online (Sandbox Code Playgroud)

顺便说一句,我是否在android:theme中定义了'theme'没有区别.

任何想法如何解决此错误?我可以编译并运行应用程序,但在创建视图时会出现NullPointerException.

Roh*_*wal 1

这也发生在我身上..进入 res>values>styles.xml

删除上一个主题行并放入这一行

<style name="AppBaseTheme" parent="android:Theme.Light">
Run Code Online (Sandbox Code Playgroud)

项目创建期间的 Eclipse 要求为应用程序定义一个主题。您可能已选择任何Holo theme. 该主题不支持MapView显示错误的内容。


归档时间:

查看次数:

4040 次

最近记录:

9 年,8 月 前