1
I’m looking to enlarge an image of imageView
that is to make that effect equal to Whatsapp when receiving an image and the user clicks on the image it opens.
1
I’m looking to enlarge an image of imageView
that is to make that effect equal to Whatsapp when receiving an image and the user clicks on the image it opens.
0
I’ll put "the cat jump" just because the example I made is too big:
I was using a GridView
to display all images but you can have a imageView
normal.
grid = (GridView) findViewById(R.id.gridview);
adapter = new GridViewAdapter(this, FilePathStrings, FileNameStrings);
grid.setAdapter(adapter);
grid.setOnItemClickListener(new OnItemClickListener()
{
@Override
public void onItemClick(AdapterView<?> parent, View view, int position, long id)
{
Intent i = new Intent(MainActivity.this, ViewImage.class);
i.putExtra("filepath", FilePathStrings);
i.putExtra("filename", FileNameStrings);
i.putExtra("position", position);
startActivity(i);
}
});
Here is the Activity that will be started at the photo click :
public class ViewImage extends Activity {
ImageView imageview;
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.view_image);
Intent i = getIntent();
int position = i.getExtras().getInt("position");
String[] filepath = i.getStringArrayExtra("filepath");
imageview = (ImageView) findViewById(R.id.full_image_view);
Bitmap bmp = BitmapFactory.decodeFile(filepath[position]);
imageview.setImageBitmap(bmp);
}
}
Here the full screen layout after clicking on the photo:
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="fill_parent"
android:layout_height="fill_parent" >
<ImageView
android:id="@+id/full_image_view"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_centerInParent="true" />
</RelativeLayout>
This was my solution because I had a product description with an image of the same below and I needed the user to be able to see the image in larger size, I just changed the GridView
for ImageView
when I went to implement.
Thanks, I will study your code here thanks for helping. And just a doubt, what would this Filepathstrings? the image path?
Okay, it’s pretty simple, I just open a new Activity in the click event and step the image and actual size.
Browser other questions tagged android
You are not signed in. Login or sign up in order to post.
Do you want to do it with a single photo or do you have a grid? @Alessandrobarreto
– Wellington Avelino
I just wish I could zoom in on the image and etc. Common effect when you want to see a better image.
– Alessandro Barreto
What have you done? I have a ready-made example but it searches straight from the SD card. @Alessandrobarreto
– Wellington Avelino
So at the time I had solved my problem with a third party lib! More Could you pass me your example for me one studied? Well I already know search the image both the gallery and both the user taking the photo of the app itself
– Alessandro Barreto
I’ll post the main content "the cat jump"
– Wellington Avelino