Skip to content

SimpleImageDialog

Philipp Niedermayer edited this page Dec 5, 2017 · 9 revisions

Image dialog

extends CustomViewDialog

A Dialog that displays an image

Building dialogs

Example

SimpleImageDialog.build()
                 .image(R.drawable.image_sample)
                 .show(Activity.this);

Additional customizations

  • Image
    .image(int resourceId)
    .image(Class<? extends Creator> builderClass)
    .image(Uri imageUri)
  • Scale / Scroll
    scaleType(Scale scale)
    Sets the scale type to one of:
  • Scale.FIT: scales the image down ensuring the image is fully visible
  • Scale.SCROLL_HORIZONTAL: scales the image up, allowing horizontal scrolling ("panorama")
  • Scale.SCROLL_VERTICAL: scales the image up, allowing vertical scrolling

Image creators

To avoid android.os.TransactionTooLargeException for large bitmaps passing a Bitmap directly is deprecated. Instead, pass a class that implements one of BitmapCreator, DrawableCreator or IconCreator.

Theme

Note that you have to use a special theme as parent when styling this dialog.
You can specify the theme using the imageDialogTheme attribute (rather than alertDialogTheme) or the theme(int resId) method.
Make sure that your theme's parent is the ImageDialogTheme, otherwise the dialog will not shrink to the image and there will be white stripes on either side of the image.

Clone this wiki locally