Picture enlargement idea:
First, you can transform the image through the Matrix object, zoom in when you choose, and zoom out to the original size when you lose focus.
Double scale = 1.2;
int width = bm.getwidth ();
int height = bm.getheight ();
LOG.I ("Size:", width+ "");
float ScaleWidth = (float) (scale*width);
float ScaleHeight = (float) (scale*height);
LOG.I ("Size:", scalewidth+ "");
Matrix matrix = new Matrix ();
Matrix.postscale (ScaleWidth, ScaleHeight);
BM = BITMAP.CREATEBITMAP (BM, 0, 0, width, height, matrix, true);
Second, through the animation
<?xml version= "1.0" encoding= "Utf-8"?>
<scale
Xmlns:android= "Http://schemas.android.com/apk/res/android"
Android:interpolator= "@android: Anim/decelerate_interpolator"
android:fromxscale= "1"
Android:toxscale= "1.1"
android:fromyscale= "1"
Android:toyscale= "1.1"
android:pivotx= "50%"
Android:pivoty= "50%"
Android:duration= ">"
</scale>
Thirdly, through setlayoutparams
View.setlayoutparams (New Gallery.layoutparams (150,150));
int mcounts = G.getcount ()-1;
if (position>0 && (Position < mcounts)) {
G.getchildat (position-1). Setlayoutparams (New Gallery.layoutparams (136, 88));
G.getchildat (position + 1). Setlayoutparams (New Gallery.layoutparams (136, 88));
}
if (position = = 0) {
G.getchildat (position + 1). Setlayoutparams (New Gallery.layoutparams (136, 88));
}
if (position = = mcounts) {
G.getchildat (position-1). Setlayoutparams (New Gallery.layoutparams (136, 88));
}
Note: where (136, 88) is the size of the picture in gallery, it is set inside the Imageadapter. (150,150) is the size of the selected image enlarged, can be arbitrarily set, as long as the difference with (136, 88) on the line, is to observe the change, I set the 150 just.
Iv. by combining animations and Layoutparam
Gallery.setonitemselectedlistener (New Onitemselectedlistener () {
@Override
Public
void onitemselected (adapterview<?> arg0, View arg1,
int arg2, long arg3) {
ImageView v = (ImageView) arg1;
if (Tempview! = null && v.hashcode ()! = Tempview.hashcode ()) {
Tempview.setlayoutparams (New Gallery.layoutparams (50,50));
}
V.startanimation (Tolarge);
Tempview = v;
V.setlayoutparams (New Gallery.layoutparams (60,60));
//
V.setlayoutparams (New Gallery.layoutparams (130,130));
Tvname.settext (Templist.get (arg2). Getpicname ());
}
@Override
Public
void onnothingselected (adapterview<?> arg0) {
Tvname.settext ("nothing selected.");
}
});