android开发时为什么ViewHolder cannot be resolved to a type 急
3个回答
展开全部
这明显是找不到这个类,或这个类的声明的范围不够大,你使用的地方引用不到
已赞过
已踩过<
评论
收起
你对这个回答的评价是?
展开全部
没有定义ViewHolder这个类!
这明显是找不到这个类,或这个类的声明的范围不够大,你使用的地方引用不到
public View getView(final int position, View convertView, ViewGroup parent) {
VideoItem videoitem = null;
View view = null;
if (convertView == null) {
videoitem = new VideoItem();
view = inflater.inflate(R.layout.player_videolist_item, null);
videoitem.videoname = (TextView) view.findViewById(R.id.videoname);
videoitem.nameTextView = (TextView) view
.findViewById(R.id.titleName);
videoitem.title_layout = (LinearLayout) view
.findViewById(R.id.title_layout);
videoitem.content_layout = (LinearLayout) view
.findViewById(R.id.content_layout);
view.setTag(videoitem);
} else {
view = convertView;
}
Object tag = view.getTag();
if (tag instanceof VideoItem) {
videoitem = (VideoItem) view.getTag();
}
Object obj = partandVideos.get(position);
if (obj instanceof String) {
String partname = (String) obj;
videoitem.nameTextView.setText(partname);
videoitem.nameTextView.setTextColor(normalTextColor);
videoitem.content_layout.setVisibility(View.GONE);
videoitem.title_layout.setVisibility(View.VISIBLE);
} else {
Video video = (Video) obj;
videoitem.title_layout.setVisibility(View.GONE);
videoitem.content_layout.setVisibility(View.VISIBLE);
videoitem.videoname.setText(video.getVideoName());
String demotype = video.getDemotype();
if (position == currPostion) {
videoitem.videoname.setTextColor(currTextColor);
} else {
videoitem.videoname.setTextColor(normalTextColor);
}
if (!PageExtra.isBuy() && Constants.VIDEO_CHARGE.equals(demotype)) {
videoitem.videoname.setTextColor(main_videolist_no);
}
}
return view;
}
这明显是找不到这个类,或这个类的声明的范围不够大,你使用的地方引用不到
public View getView(final int position, View convertView, ViewGroup parent) {
VideoItem videoitem = null;
View view = null;
if (convertView == null) {
videoitem = new VideoItem();
view = inflater.inflate(R.layout.player_videolist_item, null);
videoitem.videoname = (TextView) view.findViewById(R.id.videoname);
videoitem.nameTextView = (TextView) view
.findViewById(R.id.titleName);
videoitem.title_layout = (LinearLayout) view
.findViewById(R.id.title_layout);
videoitem.content_layout = (LinearLayout) view
.findViewById(R.id.content_layout);
view.setTag(videoitem);
} else {
view = convertView;
}
Object tag = view.getTag();
if (tag instanceof VideoItem) {
videoitem = (VideoItem) view.getTag();
}
Object obj = partandVideos.get(position);
if (obj instanceof String) {
String partname = (String) obj;
videoitem.nameTextView.setText(partname);
videoitem.nameTextView.setTextColor(normalTextColor);
videoitem.content_layout.setVisibility(View.GONE);
videoitem.title_layout.setVisibility(View.VISIBLE);
} else {
Video video = (Video) obj;
videoitem.title_layout.setVisibility(View.GONE);
videoitem.content_layout.setVisibility(View.VISIBLE);
videoitem.videoname.setText(video.getVideoName());
String demotype = video.getDemotype();
if (position == currPostion) {
videoitem.videoname.setTextColor(currTextColor);
} else {
videoitem.videoname.setTextColor(normalTextColor);
}
if (!PageExtra.isBuy() && Constants.VIDEO_CHARGE.equals(demotype)) {
videoitem.videoname.setTextColor(main_videolist_no);
}
}
return view;
}
已赞过
已踩过<
评论
收起
你对这个回答的评价是?
展开全部
没有定义ViewHolder这个类!
本回答被提问者采纳
已赞过
已踩过<
评论
收起
你对这个回答的评价是?
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询