How to Display an Image in Full Screen on Click in the Imageview

How to show imageView full screen on imageView click?

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.

Display image in full screen from gridview onClick

To display image in ImageDetailsActivity,pass image file path in intent and start activity.

holder.thumbnail.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View view) {
Intent go = new Intent(activity, ImageDetailsActivity.class);
go.putExtra("image",currentFile.getAbsolutePath());
activity.startActivity(go);
}
});

Then in detail activity onCreate method, get path and display it using either glide or something else.

if(getIntent() != null){
String path = getIntent().getStringExtra("image");
Glide.with(this)
.load(path)
.into(imageView);
}

How to display image on full screen on click android?

Pass the image path to the second Activity, in your case it is "file://" + al_images.get(int_position).getAl_imagepath().get(position).

Then from the second activity, you can simply display it using the Glide

Glide.with(context).load(path)
.into(imageView);


Related Topics



Leave a reply



Submit