2010-07-20 48 views
0

当我键入 ImageView的 AnimationDrawable我得到的错误宣称的字符串:Eclipse不recocnize的ImageView或AnimationDrawable

AnimationDrawable不能被解析为一个类型。

线14的Java问题

我不明白,我需要创建另一个类?或者,AnimationDrawables只是不在文件名 .java中?

如果我确实需要创建另一个班级,你能告诉我怎么做吗?

回答

1

您是否正在导入这些clases?

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

如果您使用的是Eclipse,你并不需要手动进口这些类:你可以按下Ctrl键++它会自动添加进口声明你需要(它也会删除那些你没有使用的)。

0

是的,你需要声明您正在使用 的观点一样,为ImageView的

import android.widget.ImageView 

同样为TextView的,

import android.widget.TextView