【发布时间】:2012-08-29 11:19:35
【问题描述】:
我正在开发需要在弹出窗口等自定义屏幕中打开内置应用程序的应用程序 但是当我调用内置应用程序时,屏幕尺寸是全屏的,而我需要自定义屏幕尺寸。内置应用程序可以是浏览器或 pdfreader 之类的任何东西。
这是我的代码:-
String strurl = "/sdcard/download/28889.pdf";
File file = new File(strurl);
if (file.exists()) {
Uri path = Uri.fromFile(file);
// Log.e("path of the file",path.toString());
Intent intent = new Intent(Intent.ACTION_VIEW);
intent.setDataAndType(path, "application/pdf");
intent.setFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP);
try {
startActivity(intent);
}
catch (ActivityNotFoundException e) {
Toast.makeText(getApplicationContext(),
"No Application Available to View PDF",
Toast.LENGTH_SHORT).show();
}
这会在我的应用程序中打开新窗口,但我需要弹出式窗口,我需要在其中显示此 pdfreader 以进行显示。
【问题讨论】:
-
对不起.. 不可能.. 使用任何第三方本机应用程序。构建您自己的 pdf 阅读器并将活动主题设置为 Dialog.. All d Best..!
-
以上评论是唯一可行的办法