Reputation: 1104
This class extend baseadapter
public View getView(int position, View convertView, ViewGroup parent) {
if (!imagepath[position].toString().equals("no picture")) {
imageLoader.DisplayImage(imagepath[position], imageview);
}
}
public void DisplayImage(String url, ImageView imageView) {
imageViews.put(imageView, url);
Bitmap bitmap = memoryCache.get(url);
if (bitmap != null) {
imageView.setImageBitmap(bitmap);
} else {
queuePhoto(url, imageView);
}
}
Suppose first view should be check first only display, but now display after check.
if (!imagepath[position].toString().equals("no picture")) {
titletext.setPadding(imageview.getWidth() + 5, 0, 0, 0);
datetext.setPadding(imageview.getWidth() + 5, 0, 0, 0);
imageview.setVisibility(View.VISIBLE);
imageLoader.DisplayImage(imagepath[position], imageview);
} else {
imageview.setVisibility(View.INVISIBLE);
imageview.setImageDrawable(null);
titletext.setPadding(0, 0, 0, 0);
datetext.setPadding(0, 0, 0, 0);
}
titletext.setText(title[position].toString());
categorytext.setText(category[position].toString());
datetext.setText(date[position].toString());
I want the textview setpadding first only display instead of the other way round.
How to solve this?
Upvotes: 0
Views: 1275
Reputation: 37729
It is because ListView
re-uses the Views
, put else condition also
public View getView(int position, View convertView, ViewGroup parent) {
if (!imagepath[position].toString().equals("no picture")) {
imageLoader.DisplayImage(imagepath[position], imageview);
}
else{
imageview.setImageResource(android.R.color.transparent);
// OR
imageview.setImageDrawable(null);
}
}
Upvotes: 6