【发布时间】:2017-03-30 15:58:14
【问题描述】:
我正在开发一个看起来像启动器但用于书籍的应用程序。
在主要活动中,我有书籍图像,我可以通过点击在特定的阅读器应用程序中打开它们。它工作正常。
但是当我从阅读器应用程序返回时,我的布局被破坏了,状态栏覆盖了活动的顶部。如果我再次打开阅读器应用程序并再次返回主 Activity - 一切都很好!
这是我用于有意打开书籍的代码:
Intent intent = new Intent(Intent.ACTION_VIEW);
Uri bookFileUri = Uri.fromFile(new File(book.getFilePath()));
String extension = android.webkit.MimeTypeMap.getFileExtensionFromUrl(bookFileUri.toString());
String mimeType = android.webkit.MimeTypeMap.getSingleton().getMimeTypeFromExtension(extension);
intent.setDataAndType(bookFileUri, mimeType);
try {
startActivity(intent);
} catch (ActivityNotFoundException ex) {
Log.d("Onyx", ex.getMessage());
Toast.makeText(getApplicationContext(), getResources().getString(R.string.error_opening_book_message), Toast.LENGTH_LONG).show();
}
and after first time when i'm got back, i see this (look to top of activity)
如何解决?
【问题讨论】:
-
你实现了
onPause()或onResume() -
我没有实现它
-
布局是在
onCreate()中膨胀还是程序生成的? -
它在 onCreate 中膨胀了
标签: java android user-interface