下面是我的代码片段:
import android.app.Activity;
import android.app.Bundle;
import android.app.ListActvity;
import android.app.ListView;
import android.app.AbsListView;
import android.app.AdapterView;
....
public class MyDemo extends ListActivity {
@Override public void onCreate(Bundle icicle) {
ListView myLV = (ListView) findViewByID(R.id.ListView1);
myLV.setChoiceMode(SINGLE_CHOICE_MODE);
}
}
当我尝试编译时,javac报告错误: can't find symbol SINGLE_CHOICE_MODE。有什么想法吗?我没有导入正确的文件吗?
发布于 2013-04-02 13:36:09
CHOICE_MODE_SINGLE
常量是ListView
类的成员。正确用法:
myLV.setChoiceMode(ListView.CHOICE_MODE_SINGLE);
发布于 2013-04-02 13:37:14
您必须调用正确的常量,即CHOICE_MODE_SINGLE
。
https://stackoverflow.com/questions/15765489
复制