1

我的问题是,当我想从 Gridview 单击图像时,我想使用 android 标准查看器显示它,请帮助我,这是我的代码!

public class ImageAdapterForGallery extends BaseAdapter {
private Context mContext;
public static Uri uri;
static File root = new File(Environment.getExternalStorageDirectory()
        + "/Rasha Bani Hani/");
static File[] gLry = root.listFiles();
int count = gLry.length;

public ImageAdapterForGallery(Context c) {
    mContext = c;

}

public int getCount() {
    return gLry.length; }

public Object getItem(int position) {
    return gLry[position];
}

public long getItemId(int position) {
    return position;
}

public View getView(int position, View convertView, ViewGroup parent) {

    uri = Uri.fromFile(gLry[position]);

    ImageView imageView;
    imageView = new ImageView(mContext);
    imageView.setScaleType(ImageView.ScaleType.CENTER_CROP);
    imageView.setLayoutParams(new GridView.LayoutParams(180, 180));

    imageView.setImageURI(uri);
    return imageView;

}}    

在这里需要帮助!谢谢!

4

1 回答 1

0

您可以使用 打开图像意图ACTION_VIEW

请参阅这个SO question。单击 GridView 中的图像时,您可以调用意图。

于 2013-04-17T18:27:45.973 回答