0

NotFoundException が発生します。見つからないのは activity_fullscreen であることを R.java で既に確認しました。それは正常に動作する日食によって例として作成されたフルスクリーンアクティビティと同じ場所にあります。しかし、私のは実行されません。ソース:

package com.example.dreamadventure;

import android.app.Activity;
import android.os.Bundle;
import android.os.Handler;
import android.view.MotionEvent;
import android.view.View;
import android.widget.ImageView;
import android.view.View.OnClickListener;

public class FullscreenActivity extends Activity {

    ImageView image;

private static final boolean TOGGLE_ON_CLICK = true;

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);

        setContentView(R.layout.activity_fullscreen);
        final View contentView = findViewById(R.id.fullscreen);

        image = (ImageView) findViewById(R.id.hintergrund);
        image.setImageResource(R.drawable.eulenloch);

    }
}

XML:

   <View xmlns:android="http://schemas.android.com/apk/res/android"
    android:id="@+id/fullscreen" 
    android:layout_height="fill_parent" 
    android:layout_width="fill_parent" 
    android:keepScreenOn="true"
    android:layout_centerHorizontal="true"
    android:background="#FFFFFF" >

    <ImageView android:id="@+id/hintergrund" 
        android:layout_height="wrap_content" 
        android:layout_width="wrap_content" 
        android:layout_centerHorizontal="true"
        android:layout_marginTop="50px"
        android:padding="12dip"
        android:src="@drawable/eulenloch"
        android:background="#FFFFFF">
    </ImageView>

  </View>

誰が何が悪いのか教えてもらえますか?

4

1 に答える 1

0

ビューは他のビューを保持できません。レイアウト ファイルが間違っています。ビューの代わりに LinearLayout を使用し、プロジェクトをクリーンアップすると機能します。

アップデート

      <intent-filter>
            <action android:name="android.intent.action.MAIN" />

            <category android:name="android.intent.category.DEFAULT" />
        </intent-filter>

メインフェストでのアクティビティでは、上記の代わりにこのフィルターを使用してください

     <intent-filter>
            <action android:name="android.intent.action.MAIN" />

            <category android:name="android.intent.category.LAUNCHER" />
        </intent-filter>
于 2013-02-22T09:24:29.267 に答える