How to swipe image and show top side close view on swipe image in bottom side? Runnable() {
        public void run() {
            windowWidth = mRrootLayout.getWidth();
            windowHeight = mRrootLayout.getHeight();

    imageView.setOnTouchListener(new View.OnTouchListener() {
        float initialX, initialY;
        float rawX = 0.0f, dist;

        public boolean onTouch(View v, MotionEvent event) {
            switch (event.getAction()) {
                case MotionEvent.ACTION_DOWN:
                    dY = v.getY() - event.getRawY();
                    initialX = event.getX();
                    initialY = event.getY();
                    return true;

                case MotionEvent.ACTION_MOVE:
                    v.animate().y(event.getRawY() + dY).setDuration(0).start();
                    ViewGroup.LayoutParams params2 = layoutDislike.getLayoutParams();
                    float scale2 = getResources().getDisplayMetrics().density;
                    int pixels2 = (int) (v.getY() * scale2 + 0.5f);
                    params2.height = convertPixelsToDp(pixels2, getApplicationContext());

                    ViewGroup.LayoutParams params1 = layoutLike.getLayoutParams();
                    float scale1 = getResources().getDisplayMetrics().density;
                    int pixels1 = (int) (v.getY() * scale1 + 0.5f);
                    int x = Math.abs(convertPixelsToDp(pixels1, getApplicationContext()));
                    params1.height = x;

                case MotionEvent.ACTION_UP:
                    dist = event.getX() - rawX;
                    Log.e(TAG, "onTouch:dist " + dist);
            return true;

 public static int convertPixelsToDp(float px, Context context) {
    return (int) (px / (context.getResources().getDisplayMetrics().densityDpi / DisplayMetrics.DENSITY_DEFAULT));

that code to move image in top to bottom and bottom to up but close and done icon not show properly in image full swipe in top or bottom.

enter image description here

see the image, swipe image in bottom side to show close view in top side