比文藝式更好的方式?
關于BaseAdapter的文藝模式,直接修改為下面的方式,可以嗎?
@Override public?View?getView(int?i,?View?view,?ViewGroup?viewGroup)?{???? ????if?(view?==?null)?{ ????????view?=?inflater.inflate(R.layout.news_item,?null); ????????NewsBean?bean?=?list.get(i); ???????? ????????ImageView?imageView?=?(ImageView)?view.findViewById(R.id.iv_news); ????????ImageLoader?imageLoader?=?new?ImageLoader(imageView,?bean.IconUrl); ????????imageLoader.showImageByThread();//異步加載圖片 ????????TextView?txtTitle?=?(TextView)?view.findViewById(R.id.tv_news_title); ????????txtTitle.setText(bean.Title); ????????TextView?txtContent?=?(TextView)?view.findViewById(R.id.tv_news_content); ????????txtContent.setText(bean.Content); ????} ????return?view; }
這樣也不會出現(xiàn)錯亂,也不會重復的設置圖片和文本。
請教下老師,這樣會有什么問題嗎?