Friends I have checked get drawable exactly the size of the imageView to use as a placeholder
But it did not help me
My problem is I want to display a place holder exactly of the image size
The Image size is dynamic , I am getting the image height and width from server , using that I am calculating adjusted width and height
For Example in one row of list I have to display 400 * 300 size of image and in another row I have to display 700 * 500 size of image
Now I want the place holder should fill the area 400*300 in first case and 700*500 in second case , This thing I am not able to achieve ,
How can I achieve this ?
mDisplayImageOptions = new DisplayImageOptions.Builder()
.resetViewBeforeLoading(true)
.imageScaleType(ImageScaleType.EXACTLY)
.showImageOnLoading(R.drawable.test_user)
.cacheInMemory(true)
.cacheOnDisk(true)
.build();
mAdjustedWidth = mWindowWidth - 10;
mAdjustedHeight = 400;
try {
int width = cursor.getInt(cursor.getColumnIndexOrThrow(TalkTable.TALK_TWIDTH));
if(width > 0) {
mAdjustedHeight = (mAdjustedWidth * cursor.getInt(cursor.getColumnIndexOrThrow(TalkTable.TALK_THEIGHT))) / width;
}
}catch (Exception ex){
ex.printStackTrace();
}
talkImageView.getLayoutParams().height = mAdjustedHeight;
talkImageView.getLayoutParams().width = mAdjustedWidth;
talkImageView.requestLayout();
mImageLoader.displayImage(talkImageThumbnil,talkImageView,mTalksDisplayImageOptions,new SimpleImageLoadingListener(){
@Override
public void onLoadingStarted(String imageUri, View view) {
// ProgressBar progressBar1 = (ProgressBar)progressBar.getTag();
//progressBar1.setVisibility(View.VISIBLE);
talkImageView.getLayoutParams().height = mAdjustedHeight;
talkImageView.getLayoutParams().width = mAdjustedWidth;
talkImageView.requestLayout();
talkImageView.setImageResource(R.drawable.image_place_holder);
Log.d(TAG, " Progress bar visisble ");
}
@Override
public void onLoadingFailed(String imageUri, View view, FailReason failReason) {
//ProgressBar progressBar1 = (ProgressBar)progressBar.getTag();
//progressBar1.setVisibility(View.GONE);
}
@Override
public void onLoadingComplete(String imageUri, View view, Bitmap loadedImage) {
//ProgressBar progressBar1 = (ProgressBar)progressBar.getTag();
//progressBar1.setVisibility(View.GONE);
}
@Override
public void onLoadingCancelled(String imageUri, View view) {
//ProgressBar progressBar1 = (ProgressBar)progressBar.getTag();
//progressBar1.setVisibility(View.GONE);
}
});
XML Image View
I am struggling for this from days , please help me
Place holder look like this before image download
Once Image dowloaded it look like below image
I want that the place holder should fill the exact height and width of the image which is about to display