Warning: file_get_contents(/data/phpspider/zhask/data//catemap/9/java/305.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181

Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/ssis/2.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Java 如何在android图像视图中显示pdf?_Java_Android_Pdf - Fatal编程技术网

Java 如何在android图像视图中显示pdf?

Java 如何在android图像视图中显示pdf?,java,android,pdf,Java,Android,Pdf,下面的代码是从设备中拾取图像。如何从设备中选择pdf以及如何在图像视图中显示pdf bt_gall .setOnClickListener(new View.OnClickListener() { @Override public void onClick(View view) { Intent intent = new Intent(); // S

下面的代码是从设备中拾取图像。如何从设备中选择pdf以及如何在图像视图中显示pdf

  bt_gall .setOnClickListener(new View.OnClickListener() {
                @Override
                public void onClick(View view) {
                    Intent intent = new Intent();
                    // Show only images, no videos or anything else
                    intent.setType("image/*");
                    intent.setAction(Intent.ACTION_GET_CONTENT);
                    // Always show the chooser (if there are multiple options available)
                    startActivityForResult(Intent.createChooser(intent, "Select Picture"), PICK_IMAGE_REQUEST);
                    alertDialog.dismiss();
                }
            });
要选择pdf,请尝试以下操作

Intent intent = new Intent();
        intent.setType("application/pdf");
        intent.setAction(Intent.ACTION_GET_CONTENT);
        startActivityForResult(Intent.createChooser(intent, "Select PDF"), 1);
要将Pdf设置为图像,您需要创建Pdf的缩略图

要创建缩略图,请选中此复选框


希望这能对您有所帮助。

ImageView
不支持打印pdf
pdf
文件不是图像。例如,当我按下按钮时,我想同时选择图像文件或pdf文件。代码是什么?@spodee pass multple MIME type-尝试此代码时检查此代码[Intent Intent=new Intent();intent.setType(“image/*| application/pdf”);intent.setAction(intent.ACTION_GET_CONTENT);intent.addCategory(intent.CATEGORY_OPENABLE);startActivityForResult(intent.createChooser(intent,“选择文档”),1);]只选择了图像。