On dirait qu'il ya deux façons de changer quelque chose dans les ListView
lignes:Quelle est la différence entre l'utilisation de setViewBinder/setViewValue et getView/LayoutInflater?
utilisant des
setViewBinder
/setViewValue
:myCursor.setViewBinder (nouveau SimpleCursorAdapter.ViewBinder() {
@Override public boolean setViewValue(View view, Cursor cursor, int columnIndex) { int viewId = view.getId(); switch(viewId) { case R.id.icon: // change something related to the icon here
en utilisant
getView
/LayoutInflater
:publique Voir getView (int position, Vue convertView, parent ViewGroup) {
View itemView = null; if (convertView == null) { LayoutInflater inflater = (LayoutInflater) parent.getContext() .getSystemService(Context.LAYOUT_INFLATER_SERVICE); itemView = inflater.inflate(R.layout.list_row, null); } else { itemView = convertView; } ImageView imgViewChecked = (ImageView) itemView .findViewById(R.id.icon); // change something related to the icon here
Quelle est la différence entre ces deux approches?