我在eclipse中工作,我遇到了許多其他人都有的錯誤,但事情似乎仍然沒有工作。我收到多個佈局無法解析我的drawable和id源的答案。我試着用Cntrl shift O命令我的每一行,但似乎沒有任何工作。多個不能解決的錯誤
我在看我的activity_mainxml文件,但沒有看到任何錯誤,但根據我在這裏閱讀的內容,這可能是問題的根源。
任何想法我可能會失蹤?任何建議將不勝感激。
package com.example.alltruths;
import android.app.Activity;
import android.graphics.drawable.AnimationDrawable;
import android.hardware.Sensor;
import android.hardware.SensorManager;
import android.media.MediaPlayer;
import android.os.Bundle;
import android.view.Menu;
import android.view.animation.AlphaAnimation;
import android.widget.ImageView;
import android.widget.TextView;
public class MainActivity extends Activity {
private static final String R = null;
private AllTruths mAllTruths = new AllTruths();
private TextView mAnswerLabel;
private ImageView mAllTruthsImage;
private SensorManager mSensorManage;
private Sensor mAccelerometer;
private ShakeDetector mShakeDetector;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
//Assigning Views from layout
mAnswerLabel = (TextView) findViewById(R.id.textView1);
mAllTruthsImage = (ImageView) findViewById(R.id.imageView1);
}
非常感謝。這擺脫了大部分的錯誤信息。還有一件事似乎仍然存在於我的Drawable代碼中。任何想法這裏可能是錯誤的:mAllTruthsImage.setImageResource(R.Drawable.ball_animation); AnimationDrawable ballAnimation =(AnimationDrawable)mAllTruthsImage.getDrawable(); (ballAnimation.isRunning()){ \t ballAnimation.stop(); } ballAnimation.start(); } – user3261110
@ user3261110,它應該是R.drawable.ball_animation,小寫'd'。如果它對你有幫助,請接受答案。 – Egor