Show image as a popup on a click event or any event. Simply set the image as drawable and thats it!!!. And also you can set width, height & background color as you want.
allprojects {
repositories {
...
maven { url "https://jitpack.io" }
}
}
dependencies {
compile 'com.github.chathuralakmal:AndroidImagePopup:1.2.2'
}
ImagePopup imagePopup = new ImagePopup(this);
/** Set popup height, width & background color as you need or just leave default settings **/
Picasso.setSingletonInstance(new Picasso.Builder(this).build()); // Only needed if you are using Picasso
final ImagePopup imagePopup = new ImagePopup(this);
imagePopup.setWindowHeight(800); // Optional
imagePopup.setWindowWidth(800); // Optional
imagePopup.setBackgroundColor(Color.BLACK); // Optional
imagePopup.setFullScreen(true); // Optional
imagePopup.setHideCloseIcon(true); // Optional
imagePopup.setImageOnClickClose(true); // Optional
ImageView imageView = (ImageView) findViewById(R.id.imageView);
imagePopup.initiatePopup(imageView.getDrawable()); // Load Image from Drawable
imageView.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View view) {
/** Initiate Popup view **/
imagePopup.viewPopup();
}
});
val imagePopup = ImagePopup(myContext)
imagePopup.initiatePopup(imageView.drawable) // Load Image from Drawable
imageView.setOnClickListener {
imagePopup.viewPopup();
}
// supprot string url for image
initiatePopupWithPicasso(imageUrl);
// supprot Uri for image
initiatePopupWithPicasso(imageUri);
// supprot File for image
initiatePopupWithPicasso(imageFile);
// supprot string url for image
initiatePopupWithGlide(imageUrl);
Let's make this grow. Contributions are always welcome!
The MIT License
2017 - 2019