我是Android开发的新手,我需要帮助eclipse中的幻灯片动画师。我在公共布尔onCreateOptionMenu和publicVoid onStart中的令牌错放的构造上有语法错误。
public class MainActivity extends Activity {
String Home,Gallery,Services,Aboutus;
Activity context;
AnimatorSet set;
ImageView imgView;
int imgResources[]={R.drawable.img1, R.drawable.img2,R.drawable.img3,R.drawable.img4,R.drawable.img5};
int index=0;
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
context=this;
Button viewHome= (Button)this.findViewById(R.id.button1);
viewHome.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
Intent intent= new Intent(v.getContext(),onClickListener.class);
startActivity(intent);
}
**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;**
public void onStart(){
super.onStart();
imgView=(ImageView)findViewById(R.id.imageview);
set = (AnimatorSet) AnimatorInflater.loadAnimator(this,R.animator.slideshow);
set.setTarget(imgView);
set.addListener(new AnimatorListenerAdapter(){
public void onAnimationEnd(Animator animator){
//repeat animation
if(index<imgResources.length)
{
imgView.setImageResource(imgResources[index]);
index++;
set.start();
}
}
});
set.start();
}
});
}
}