@Override
public View getView(int position, View convertView, ViewGroup parent) {
if(position == 0 || position == 2 ||
position == 6 || position == 9 || position == 12 || position == 14)
{
if (convertView == null) {
LayoutInflater mInflater = (LayoutInflater)
context.getSystemService(Activity.LAYOUT_INFLATER_SERVICE);
convertView = mInflater.inflate(R.layout.header, null);
TextView txtTitle = (TextView) convertView.findViewById(R.id.list_header_title);
txtTitle.setText(navDrawerItems.get(position).getTitle());
convertView.setOnClickListener(null);
convertView.setOnLongClickListener(null);
convertView.setLongClickable(false);
}
return convertView;
}
else
{
if (convertView == null) {
LayoutInflater mInflater = (LayoutInflater)
context.getSystemService(Activity.LAYOUT_INFLATER_SERVICE);
convertView = mInflater.inflate(R.layout.drawer_list_item, null);
}
ImageView imgIcon = (ImageView) convertView.findViewById(R.id.icon);
TextView txtTitle = (TextView) convertView.findViewById(R.id.title);
// TextView txtCount = (TextView) convertView.findViewById(R.id.counter);
try
{
imgIcon.setImageResource(navDrawerItems.get(position).getIcon());
}
catch(Exception e)
{
}
try
{
txtTitle.setText(navDrawerItems.get(position).getTitle());
}
catch(Exception e)
{
}
// displaying count
// check whether it set visible or not
/* if(navDrawerItems.get(position).getCounterVisibility()){
txtCount.setText(navDrawerItems.get(position).getCount());
}else{
// hide the counter view
txtCount.setVisibility(View.GONE);
}*/
}
return convertView;
}
我补充说,进入我的适配器......但问题是导航抽屉搞砸了.. 突然有一排越过另一排......突然滚动,底行排在上面等等。
我想解决这个问题,我的适配器类中只有值得注意的地方。在我的导航抽屉里面我只是调用listview并将适配器连接到它..
为什么要在滚动下方或顶部屏幕上出现这种情况?