8

申し訳ありませんが、このトピックに関する別の質問です。これまでのところ、それに関するすべての投稿を読みましたが、これまでのところ、答えはどれもうまくいきませんでした. 私は今それを修正しようと何時間も費やしてきましたが、髪を引き抜き始める前に、ここでもう一度試してみたいと思います.

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

これが私のレイアウト 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>

私の 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.)

ちなみに、android:theme で「テーマ」を定義しているかどうかは関係ありません。

このエラーを修正する方法はありますか? アプリをコンパイルして実行できますが、ビューの作成時に NullPointerException が発生します。

4

1 に答える 1

1

これは私にも起こりました.. res>values>styles.xmlに移動します

前のテーマ行を削除して、これを入れます

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

プロジェクト作成中の日食は、アプリケーションのテーマを定義するよう求めます。を選択した可能性がありますHolo themeMapViewこのテーマは、エラーが表示されているものをサポートしていません。

于 2013-06-07T03:07:38.793 に答える