我有一个自定义的ArrayAdapter类:
public class DrawerArrayAdapter<T> extends ArrayAdapter<T> {
int disabledItemPosition;
@Override
public boolean areAllItemsEnabled() {
// TODO Auto-generated method stub
return false;
}
@Override
public boolean isEnabled(int position) {
// TODO Auto-generated method stub
if(disabledItemPosition ==position){
return false;
} else {
return super.isEnabled(position);
}
}
public DrawerArrayAdapter(Context context, int resource) {
super(context, resource);
// TODO Auto-generated constructor stub
}
public DrawerArrayAdapter(Context context, int resource,
int textViewResourceId) {
super(context, resource, textViewResourceId);
// TODO Auto-generated constructor stub
}
public DrawerArrayAdapter(Context context, int resource, T[] objects) {
super(context, resource, objects);
// TODO Auto-generated constructor stub
}
public DrawerArrayAdapter(Context context, int resource, List<T> objects) {
super(context, resource, objects);
// TODO Auto-generated constructor stub
}
public DrawerArrayAdapter(Context context, int resource, List<T> objects, int disabledItemPosition) {
super(context, resource, objects);
// TODO Auto-generated constructor stub
this.disabledItemPosition = disabledItemPosition;
}
public DrawerArrayAdapter(Context context, int resource,
int textViewResourceId, T[] objects) {
super(context, resource, textViewResourceId, objects);
// TODO Auto-generated constructor stub
}
public DrawerArrayAdapter(Context context, int resource,
int textViewResourceId, List<T> objects) {
super(context, resource, textViewResourceId, objects);
// TODO Auto-generated constructor stub
}
}
但是当我尝试用它构建它时:
new DrawerArrayAdapter<String>(this, R.layout.drawer_list_item, mPlanetTitles, 9)
Eclipse抱怨&#34;构造函数DrawerArrayAdapter(MainActivity,int,String [],int)未定义&#34;
答案 0 :(得分:0)
字符串数组不能转换为List,也许我会错过带有String(或T)数组的4 params构造函数,但我认为这就是问题所在。