开发者

Eclipse doesn't recocnize ImageView or AnimationDrawable

When I type ImageView or AnimationDrawable I get a string of errors proclaiming:

AnimationDrawable cannot be resolved to a type.

line 14 Java Problem

I don't understand, do I need to create ano开发者_运维技巧ther class? Or do the AnimationDrawables just not go in the filename.java?

And if I do need to create another class, can you show me how?


Are you importing those clases?

// this must be placed at beginning of your file
// after the 'package' statemen
import android.widget.ImageView;
import android.graphics.drawable.AnimationDrawable;

If you are using Eclipse, you don't need to manually import those classes: you can press Ctrl+Shift+i and it will automatically add the imports statements that you need (it will also remove the ones that you are not using).


yes you need to declare the view that you are using like, for imageview

import android.widget.ImageView

likewise for textview,

import android.widget.TextView
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜