0

I create one Custom List View. I want to zoom image when I click Imageview. Its similar to whats app. when I click DP of any person that time it zoom. Similar I want in my project. How can it work.

enter image description here

I want just like this Thanks in advance friends.!

2 Answers 2

1

I would suggest you to use the "Zooming a View" example from Android Dev site

http://developer.android.com/training/animation/zoom.html

It is quite simple and it works great!

Sign up to request clarification or add additional context in comments.

Comments

0

There is many of the ways to do that.

I can explain here with PopupWindow

Step 1:

your_main_imageview.setOnClickListener(new OnClickListener() {

                    @Override
                    public void onClick(final View anchorView) {
View popupView = getLayoutInflater().inflate(
                                    R.layout.popup_layout, null);
//Note: Add an imageView in this popup_layout.
ImageView image_button = (ImageView) popupView
                                    .findViewById(R.id.your_imageview);
//Set image for imageView here
PopupWindow popupWindow = new PopupWindow(popupView,
                                    LayoutParams.MATCH_PARENT,
                                    LayoutParams.MATCH_PARENT);
// If the PopupWindow should be focusable
                            popupWindow.setFocusable(false);
                            popupWindow.setOutsideTouchable(false);
                            // If you need the PopupWindow to dismiss when when
                            // touched outside
                            popupWindow
                                    .setBackgroundDrawable(new ColorDrawable());

                            final int location[] = new int[2];

                            // Get the View's(the one that was clicked in the
                            // Fragment) location
                            anchorView.getLocationOnScreen(location);
anchorView.post(new Runnable() {

                                @Override
                                public void run() {
                                    // Using location, the PopupWindow will be
                                    // displayed right under anchorView
                                    popupWindow.showAtLocation(
                                            anchorView,
                                            Gravity.NO_GRAVITY,
                                            location[0],
                                            location[1]
                                                    + anchorView.getHeight());
                                }
                            });


}

This is not complete code. Ask any doubts i will explain in comments

2 Comments

Its working partially. When I click on Image that time Image is hiding and other part is showing in pop up window.
Then you need to make changes in popup_layout. That is in my code for inflate

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.