大佬教程收集整理的这篇文章主要介绍了android – 使用SimpleCursorAdapter和ViewBinder在ListView项目中设置图像,大佬教程大佬觉得挺不错的,现在分享给大家,也给大家做个参考。
private void updatetiR_327_11845@elineUI() { cursor data = dbHelper.query(Constants.TABLE_NAME,null,null); if (data.moveToFirst()) { adapter = new SimplecursorAdapter(this,R.layout.tweet_row,data,new String[] {Constants.CREATED_TIME,Constants.username,Constants.PROFILE_IMAGE,Constants.TWEET},new int[] {R.id.time,R.id.username,R.id.userImageView,R.id.tweetmessagE}); SimplecursorAdapter.ViewBinder viewBinder = new SimplecursorAdapter.ViewBinder() { public Boolean setViewValue(View view,cursor cursor,int columnIndeX) { if(view != null && view.getId() != R.id.userImageView) { return false; } String imageUrlString = cursor.getString(columnIndeX); String username = cursor.getString(cursor.getcolumnIndex(Constants.username)); String path = getDir("images",MODE_PRIVATE).getAbsolutePath() + "/" + username + ".png"; ImageDownloader downloader = new ImageDownloader(); downloader.setImageUrlString(imageUrlString); downloader.setImageView(view); downloader.setFilePath(path); downloader.execute(imageUrlString); return true; } }; int index = data.getcolumnIndex(Constants.PROFILE_IMAGE); //Log.d(Constants.TAG,"" + indeX); adapter.setViewBinder(viewBinder); viewBinder.setViewValue(userImageView,indeX); timelineList.setAdapter(adapter); } }
有没有办法用这种方法将图像设置为正确的行?
以上是大佬教程为你收集整理的android – 使用SimpleCursorAdapter和ViewBinder在ListView项目中设置图像全部内容,希望文章能够帮你解决android – 使用SimpleCursorAdapter和ViewBinder在ListView项目中设置图像所遇到的程序开发问题。
如果觉得大佬教程网站内容还不错,欢迎将大佬教程推荐给程序员好友。
本图文内容来源于网友网络收集整理提供,作为学习参考使用,版权属于原作者。
如您有任何意见或建议可联系处理。小编QQ:384754419,请注明来意。