向下滚动时,GridView项目变为不可见。这不会一直发生,但通常发生在MOTOROLA NEXUS SIX上。
我的适配器代码中没有使用VIEW.GONE或VIEW.INVISIBLE。
你可以帮我解决这个问题吗?
以下是适配器代码 -
public LikeMindedUserAdapter(Context context, ArrayList<LMUserModel> listData) {
mContext = context;
mUtility = new Utility(mContext);
mListData = listData;
}
@Override
public int getCount() {
if (mListData != null && mListData.size() > 0)
return mListData.size();
return 0;
}
@Override
public Object getItem(int position) {
return position;
}
@Override
public long getItemId(int position) {
return position;
}
@Override
public View getView(int position, View convertView, ViewGroup parent) {
ViewHolder viewHolder;
if (convertView == null) {
LayoutInflater inflater = (LayoutInflater) mContext.getSystemService(Context.LAYOUT_INFLATER_SERVICE);
viewHolder = new ViewHolder();
convertView = inflater.inflate(R.layout.item_likeminded_user, null);
viewHolder.tv_username = (CustomTextView) convertView.findViewById(R.id.tv_username);
viewHolder.tv_uinit = (CustomTextView) convertView.findViewById(R.id.tv_uinit);
viewHolder.iv_profile = (RoundedImageView) convertView.findViewById(R.id.iv_profile);
viewHolder.pbar = (ProgressBar) convertView.findViewById(R.id.pbar);
viewHolder.iv_userpin = (ImageView) convertView.findViewById(R.id.iv_userpin);
convertView.setTag(viewHolder);
} else {
viewHolder = (ViewHolder) convertView.getTag();
}
LMUserModel likeMindedUserModel = mListData.get(position);
viewHolder.tv_username.setText(likeMindedUserModel.getName());
viewHolder.tv_uinit.setText(likeMindedUserModel.getName());
double userMatchingScore = 0;
if (likeMindedUserModel.getCueModel() != null) {
userMatchingScore = likeMindedUserModel.getCueModel().getMatchingScore();
}
String userGrade = likeMindedUserModel.getGrade();
if (userGrade != null && !userGrade.equalsIgnoreCase("")) {
mUtility.setUserProfilePicWithGrade(userGrade, userMatchingScore, viewHolder.iv_profile, viewHolder.iv_userpin);
} else {
userGrade = Constants.UserGrade.JUNIOR;
mUtility.setUserProfilePicWithGrade(userGrade, userMatchingScore, viewHolder.iv_profile, viewHolder.iv_userpin);
}
return convertView;
}
private class ViewHolder {
private RoundedImageView iv_profile = null;
private CustomTextView tv_username = null;
private CustomTextView tv_uinit = null;
private ProgressBar pbar = null;
private ImageView iv_userpin = null;
}