Search code examples
androidimageviewfullscreenandroid-fullscreen

How to show imageView full screen on imageView click?


I am getting images from url and showing it on the imageView. This functionality is working properly. But I want that when I click on that image, then it must be full screen. So how to achieve this functionality? I know I am missing something. Please help me. Screenshot is attached. I want the same functionality in my app also.

Before clicking After clicking

Here is my code, which I am trying on Image click:

    @Override
    public void onClick(View v) {
        if (isTouch1) {
            horizontalScrollView.setVisibility(View.GONE);
            isTouch1 = false;
            // mSystemUiHider.toggle();
            setTheme(R.style.FullscreenTheme);
            Log.d("Here isTouch is true", ">");
            // ChangeThemeUtils.changeToTheme(FullScreenImageAdapter.this, ChangeThemeUtils.THEME_HIDE_ALL_WINDOW);
            getSupportActionBar().hide();

        } else {
            isTouch1 = true;
            horizontalScrollView.setVisibility(View.VISIBLE);
            getSupportActionBar().show();
            setTheme(R.style.ExampleTheme);
            //mSystemUiHider.show();
            Log.d("Here isTouch is false", ">");    
        }
    }

Solution

  • Yes I got the trick.

    public void onClick(View v) {
    
                if( Build.VERSION.SDK_INT >= Build.VERSION_CODES.ICE_CREAM_SANDWICH ){
                    imgDisplay.setSystemUiVisibility( View.SYSTEM_UI_FLAG_HIDE_NAVIGATION );
    
                }
                else if( Build.VERSION.SDK_INT >= Build.VERSION_CODES.HONEYCOMB )
                    imgDisplay.setSystemUiVisibility( View.STATUS_BAR_HIDDEN );
                else{}
    
        }
    

    But it didn't solve my problem completely. I want to hide the horizontal scrollview too, which is in front of the imageView (below), which can't be hidden in this.