【问题标题】:how can i get android inbuilt image gallery in to my application?如何在我的应用程序中获取 android 内置图片库?
【发布时间】:2012-03-08 19:32:23
【问题描述】:

我已经实现了一个应用程序,用于在用户单击图像按钮时从外部存储中获取图像。如果用户单击按钮,我可以从 sd 卡中获取图像。但我无法查看幻灯片以获取一张图片。我实现的代码如下:

  ((ImageView)findViewById(R.id.getImage)).setOnClickListener(new OnClickListener() {

    @Override
    public void onClick(View v) {

        Intent intent = new Intent();
        intent.setType("image/*");
        intent.setAction(Intent.ACTION_GET_CONTENT);
        startActivity(intent);
    }
});

从上面的代码中,我从 sdcard 获取所有图像,但我无法查看 android 内置幻灯片图像查看器。

如何获得安卓幻灯片图像查看器?

请任何人帮助我....

【问题讨论】:

标签: android image gallery android-sdcard


【解决方案1】:

使用 ViewFlipper

  ViewFlipper vf=(ViewFlipper)findViewById(R.id.ViewFlipper1);
  ImageView img=(imageView)findviewById(R.id.imageView1);
  Button btn=(Button)findViewById(R.id.button1);

  img.setOnClickListener(this);
  btn.setOnClickListener(this);


  public void OnClick(View v)
  {
    Switch(v.getId())
    {
       case R.id.imageView1 :

        Intent intent = new Intent();
        intent.setType("image/*");
        intent.setAction(Intent.ACTION_GET_CONTENT);
        startActivity(intent);
        vf.showNext();
        break;

        case R.id.button1:
        vf.showPrevious();
        break;
  }

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 2010-10-07
    • 2013-12-29
    • 1970-01-01
    • 2011-01-11
    • 2013-05-28
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多