I'm new to android.What is the easiest way to pop an imageview to full screen (with pinch zoom enabled),when it is tapped, just like whatsapp images? I'm loading my images in a recycler view via Glide. Thank you for your time and reply.
Press the keys Option–Command–F to view image in Full Screen.
How to show the full size image in popup on clicking the image in android. Below is the code that will show the full size image in a dialog box popup without defining layout xml file . int a=v. getId(); intiger "a" will have the value equal to profile_pic if we touched on profile_pic imageview else we will get pro id .
The quickest way to get Chrome in full-screen mode in Windows is to press F11 on the keyboard. The other way is through the Chrome menu: In the upper-right corner of Chrome, select the menu (three-dot) icon. In the Zoom section, select the square icon on the right.
I used PhotoView (https://github.com/chrisbanes/PhotoView) and Glide (https://github.com/bumptech/glide).
I created full screen activity first and put PhotoView in layout.
<?xml version="1.0" encoding="utf-8"?>
<FrameLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="#000000"
tools:context=".PhotoviewerActivity">
<com.github.chrisbanes.photoview.PhotoView
android:id="@+id/fullscreen_content"
android:layout_width="match_parent"
android:layout_height="match_parent"
/>
</FrameLayout>
Then, I pass image URL that I want to show to the full screen activity and load image with Glide like below.
val imageUrl = intent.getStringExtra(IMAGE_URL)
Glide.with(applicationContext).load(imageUrl).into(fullscreen_content)
You can remove all not needed code from full screen layout and also disable from full screen activity code. These codes are written in Kotlin.
There is a library called StfalconImageViewer. It supports transition animation for image opening and closing, pinch-to-zoom and swipe-to-dismiss gestures out of the box. Using Glide it'll be done like this:
new StfalconImageViewer.Builder<>(context, images, new ImageLoader<String>() {
@Override
public void loadImage(ImageView imageView, String imageUrl) {
Glide.with(context).load(imageUrl).into(imageView)
}
}).show();
Hope this helps!
You are able to use ImageView
view with scale type is FIT_XY
(see more about scale type of ImageView
here)
To zoom an image you can use a third lib such as this one or write a class by yourself(see here)
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With