내가getCount() baseAdapter의 여러 번
public class NavRightDrawerListAdapter extends BaseAdapter {
private Context context;
LinkedList<String> userNameUsedForListView;
Map<String, Bitmap> urlUserImage;
public NavRightDrawerListAdapter(Context context, LinkedList<String> userNameUsedForListView, Map<String, Bitmap> returnBitMapFromURL) {
this.context = context;
this.userNameUsedForListView = userNameUsedForListView;
this.urlUserImage = returnBitMapFromURL;
}
@Override
public View getView(int position, View convertView, ViewGroup parent) {
int count = 0;
if (convertView == null) {
LayoutInflater mInflater = (LayoutInflater) context.getSystemService(Activity.LAYOUT_INFLATER_SERVICE);
convertView = mInflater.inflate(R.layout.drawer_list_of_action, null);
}
ImageView imgIcon = (ImageView) convertView.findViewById(R.id.icon);
TextView txtTitle = (TextView) convertView.findViewById(R.id.title);
imgIcon.setImageBitmap(urlUserImage.get(userNameUsedForListView.get(count)));
txtTitle.setText(userNameUsedForListView.get(count));
count++;
return convertView;
}
@Override
public int getCount() {
return userNameUsedForListView.size();
}
@Override
public Object getItem(int position) {
// TODO Auto-generated method stub
return null;
}
@Override
public long getItemId(int position) {
// TODO Auto-generated method stub
return 0;
}
내 목록 크기 내가 아이콘을 삽입하는 데 사용할 BaseAdapter
과 서랍 안에리스트 뷰의 각 행에 대해 textView
확장이 클래스있다라는 1, getView는 일반적으로 1 번 호출되지만 getCount는 6 번 호출됩니까? 왜? 정상적인 행동인가요?
나는 이것을 필요로하지 않기 때문에 getItem()
과 getItemId()
을 구현하지 않았으므로 어쨌든 구현해야합니까?
감사합니다.
AdapterView가 준비 중이며 하위 뷰를 배치하는 동안 어댑터 메소드는 임의의 횟수만큼 호출 될 수 있습니다. 그렇습니다. 정상입니다. –