我在一个活动中有 4 个图像视图,我希望如果用户单击任何图像.. 图像应该弹出并全屏显示.. 我怎么能做到这一点?
使用 webviews 是更好的选择吗?
代码:包com.integrated.mpr;
import java.io.File;
import android.app.Activity;
import android.graphics.Bitmap;
import android.graphics.BitmapFactory;
import android.os.Bundle;
import android.os.Environment;
import android.widget.ImageView;
import android.widget.TextView;
public class FinalShow extends Activity{
ImageView iva;
ImageView ivb;
ImageView ivc;
ImageView ivd;
File folder = null;
Model model = new Model();
@Override
protected void onCreate(Bundle savedInstanceState) {
// TODO Auto-generated method stub
super.onCreate(savedInstanceState);
setContentView(R.layout.finalshow);
iva = (ImageView) findViewById(R.id.iva);
ivb = (ImageView) findViewById(R.id.ivb);
ivc = (ImageView) findViewById(R.id.ivc);
ivd = (ImageView) findViewById(R.id.ivd);
String sdcardstate = android.os.Environment.getExternalStorageState();
if(sdcardstate.contentEquals(android.os.Environment.MEDIA_MOUNTED)){
String filepath = Environment.getExternalStorageDirectory().getPath();
folder = new File(filepath,model.s);//model.s contains the name of folder
File fa = new File(folder,"bmp1.png");
Bitmap bmpa = BitmapFactory.decodeFile(fa.getAbsolutePath());
iva.setImageBitmap(bmpa);
File fb = new File(folder,"bmp2.png");
Bitmap bmpb = BitmapFactory.decodeFile(fb.getAbsolutePath());
ivb.setImageBitmap(bmpb);
File fc = new File(folder,"bmp3.png");
Bitmap bmpc = BitmapFactory.decodeFile(fc.getAbsolutePath());
ivc.setImageBitmap(bmpc);
File fd = new File(folder,"bmp4.png");
Bitmap bmpd = BitmapFactory.decodeFile(fd.getAbsolutePath());
ivd.setImageBitmap(bmpd);
}
}
}