-1
您好我正在开发一个Android应用程序,没有什么花哨只是一些小的大学。当我使用R I最终位收到一个错误。例如R.id. mediAware 任何帮助将不胜感激。误差android.R
这里是我的代码是否有帮助:
package com.example.medicalapp;
import android.app.Activity;
import android.content.Intent;
import android.os.Bundle;
import android.view.Menu;
import android.view.MenuItem;
import android.view.animation.Animation;
import android.view.animation.Animation.AnimationListener;
import android.view.animation.AnimationUtils;
import android.widget.ImageView;
import android.widget.TextView;
import com.example.medicalapp.R;
public class MainActivity extends Activity {
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
ImageView img1 = (ImageView) findViewById(R.id.mediAware);
ImageView splash_image2 = (ImageView) findViewById(R.id.mediAware2);
Animation fade1 = AnimationUtils.loadAnimation(this, R.anim.fadein);
Animation fade2 = AnimationUtils.loadAnimation(this, R.anim.fadein2);
fade2.setAnimationListener(new AnimationListener() {
public void onAnimationEnd (Animation animation) {
Intent intent = new Intent(new Intent(MainActivity.this, MenuActivity.class));
startActivity(intent);
}
public void onAnimationStart(Animation animation){
}
public void onAnimationRepeat(Animation animation){
}
});
splash_image.startAnimation(fade1);
splash_image2.startAnimation(fade2);
}
@Override
public boolean onCreateOptionsMenu(Menu menu) {
// Inflate the menu; this adds items to the action bar if it is present.
getMenuInflater().inflate(R.menu.main, menu);
return true;
}
@Override
public boolean onOptionsItemSelected(MenuItem item) {
// Handle action bar item clicks here. The action bar will
// automatically handle clicks on the Home/Up button, so long
// as you specify a parent activity in AndroidManifest.xml.
int id = item.getItemId();
if (id == R.id.action_settings) {
return true;
}
return super.onOptionsItemSelected(item);
}
}
尝试做一个“干净的构建”,然后帮助重建。引用R文件时出错 – moffeltje 2014-12-07 20:23:44
我做了一个清理和重建,现在所有活动都包含R的错误 – 2014-12-07 20:56:34
大多数情况下,当您遇到这种错误时,是因为在您的XML布局的其他地方出现错误,检查你的布局和清单的任何编码错误。 – 2014-12-07 23:20:10