-1
我用網格視圖和滾動2-3次網格視圖圖像後變爲不可見在android系統 變得不可見的代碼點擊here我用網格視圖和滾動2-3次網格視圖圖像後的Android
我用網格視圖和滾動2-3次網格視圖圖像後變爲不可見在android系統 變得不可見的代碼點擊here我用網格視圖和滾動2-3次網格視圖圖像後的Android
試試這個代碼: -
public class MyProfileArrayAdapter extends BaseAdapter {
Context context;
ArrayList<MyProfileBean> myProfileBeen1;
View gridViewAndroid;
public MyProfileArrayAdapter(Context context, ArrayList<MyProfileBean> myProfileBeen1) {
this.context = context;
this.myProfileBeen1 = myProfileBeen1;
}
@Override
public int getCount() {
return myProfileBeen1.size;
}
@Override
public Object getItem(int position) {
return null;
}
@Override
public long getItemId(int position) {
return 0;
}
@Override
public int getViewTypeCount() {
int Count = myProfileBeen1.size;
return Count;
}
@Override
public int getItemViewType(int position) {
return position;
}
/*private view holder class*/
public View getView(int position, View convertView, ViewGroup parent) {
final ViewHolder holder;
if (convertView == null) {
LayoutInflater inflater = (LayoutInflater) context.getSystemService(LAYOUT_INFLATER_SERVICE);
convertView = inflater.inflate(R.layout.myprofile_adapter, parent, false);
holder.view2 = (TextView) convertView.findViewById(R.id.UrlimageText);
holder.view4 = (ImageView) convertView.findViewById(R.id.Urlimage);
}
else {
holder = (ViewHolder) convertView.getTag();
}
holder.view2.setText(myProfileBeen1.get(position).getName());
if (myProfileBeen1.get(position).getUrl().equals("")) {
Picasso.with(this.context)
.load(R.drawable.defaultbignewone)
.centerCrop()
.noFade()
.resize(150, 150)
.error(R.drawable.defaultbignewone)
.into(holder.view4);
} else {
Picasso.with(context)
.load(myProfileBeen1.get(position).getUrl())
.placeholder(R.drawable.defaultbignewone)
.centerCrop()
.noFade()
.resize(150, 150)
.into(holder.view4);
}
return convertView;
}
private static class ViewHolder {
TextView view2;
ImageView view4;
}
}
不工作.. :( –
你試過上面的代碼嗎?讓我知道。 –
什麼你已經完成的工作? – Amy
你可以把你的代碼? –
是的,請檢查 –