0

我得到一个 NotFoundException。我已经用 R.java 发现它是未找到的 activity_fullscreen。它与全屏活动中的位置相同,全屏活动是由 eclipse 作为示例创建的,效果很好。但我的不会跑。资源:

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 而不是 View,清理你的项目,它会工作

更新

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

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

在 mainfest 的活动中使用这个过滤器而不是上面的

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

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