0
我正在嘗試使圖像從左到右,從右到左移動。這是我的代碼有:令牌上的語法錯誤
package com.example.;
import android.os.Bundle;
import android.app.Activity;
import android.view.Menu;
import android.view.animation.TranslateAnimation;
import android.widget.ImageView;
public class PlayActivity extends Activity {
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_play);
}
ImageView imageView2 = (ImageView) findViewById(R.id.imageView2);
TranslateAnimation animation = new TranslateAnimation(0.0f, 400.0f,
0.0f, 0.0f);
animation.setDuration(5000);
animation.setRepeatCount(5);
animation.setRepeatMode(2);
animation.setFillAfter(true);
imageView2.startAnimation(animation);
在最後5行
但是它給了我這些錯誤:
Multiple markers at this line
- Syntax error on token(s), misplaced
construct(s)
- Syntax error on token "5000", delete this
token
Multiple markers at this line
- Syntax error on token "5", delete this
token
- Syntax error on token(s), misplaced
Multiple markers at this line
- Syntax error on token(s), misplaced
construct(s)
- Syntax error on token "2", delete this
token
Multiple markers at this line
- Syntax error on token "true", delete this
token
- Syntax error on token(s), misplaced
Multiple markers at this line
- Syntax error on token(s), misplaced construct(s)
- Syntax error on token "animation", VariableDeclaratorId expected after
this token
有人能告訴我該怎麼解決?除了那些5行似乎一切都還好