在我的cn1应用程序中,我想显示一些已经格式化为HTML的内容,因此我认为仅停留在WebView中而不是尝试对其进行解析并为每个段落创建单独的cn1组件等是最有意义的。
问题是我无法说服该应用程序实际显示它。
这是我的代码:
WebBrowser web = new WebBrowser();
web.setURL(StateMachine.URL_PREFIX + "/api/article_body.php?articleId=" + (String)map.get("id"));
mac.findArticleBodyContainer(f).addComponent(BorderLayout.CENTER, web);
form.revalidate();
这是当我在Android设备上打开应用程序时的logcat输出(运行棉花糖,以前使用Lollipop也不起作用,但是我没有该日志):
02-22 11:08:01.844 25899-25899/? W/AwContents: onDetachedFromWindow called when already detached. Ignoring
02-22 11:08:01.849 25899-25899/? W/ResourceType: No package identifier when getting value for resource number 0x00000000
02-22 11:08:02.188 25899-26296/? E/libEGL: validate_display:255 error 3008 (EGL_BAD_DISPLAY)
02-22 11:08:02.408 25899-25899/? W/cr_BindingManager: Cannot call determinedVisibility() - never saw a connection for the pid: 25899
02-22 11:08:02.956 1786-1786/? W/AutostartServic: type=1400 audit(0.0:4802979): avc: denied { search } for name="26253" dev="proc" ino=2312770 scontext=u:r:untrusted_app:s0:c512,c768 tcontext=u:r:kernel:s0 tclass=dir permissive=0
02-22 11:08:02.956 1786-1786/? W/AutostartServic: type=1400 audit(0.0:4802980): avc: denied { search } for name="26254" dev="proc" ino=2312771 scontext=u:r:untrusted_app:s0:c512,c768 tcontext=u:r:kernel:s0 tclass=dir permissive=0
02-22 11:08:02.956 1786-1786/? W/AutostartServic: type=1400 audit(0.0:4802981): avc: denied { search } for name="26255" dev="proc" ino=2312772 scontext=u:r:untrusted_app:s0:c512,c768 tcontext=u:r:kernel:s0 tclass=dir permissive=0
02-22 11:08:02.956 1786-1786/? W/AutostartServic: type=1400 audit(0.0:4802982): avc: denied { search } for name="26256" dev="proc" ino=2312773 scontext=u:r:untrusted_app:s0:c512,c768 tcontext=u:r:kernel:s0 tclass=dir permissive=0
02-22 11:08:02.956 1786-1786/? W/AutostartServic: type=1400 audit(0.0:4802983): avc: denied { search } for name="26257" dev="proc" ino=2312774 scontext=u:r:untrusted_app:s0:c512,c768 tcontext=u:r:kernel:s0 tclass=dir permissive=0
02-22 11:08:02.956 1786-1786/? W/AutostartServic: type=1400 audit(0.0:4802984): avc: denied { search } for name="26258" dev="proc" ino=2312775 scontext=u:r:untrusted_app:s0:c512,c768 tcontext=u:r:kernel:s0 tclass=dir permissive=0
02-22 11:08:02.956 1786-1786/? W/AutostartServic: type=1400 audit(0.0:4802985): avc: denied { search } for name="26259" dev="proc" ino=2312776 scontext=u:r:untrusted_app:s0:c512,c768 tcontext=u:r:kernel:s0 tclass=dir permissive=0
02-22 11:08:03.160 778-1444/? W/InputMethodManagerService: Window already focused, ignoring focus gain of: com.android.internal.view.IInputMethodClient$Stub$Proxy@40f6863 attribute=null, token = android.os.BinderProxy@f97c335
尽管在其他Android设备(以及棉花糖)上也遇到了相同的问题,但我尚未在其他任何操作系统上进行尝试。
注意:这个SO问题有一个答案,但适用于本机Android。我没有从cn1以相同方式访问webview设置的方法。
我将HTML内容移至应用程序,并从本地文件加载。我没有从模拟器中得到任何错误,但是没有内容显示。在我的Android设备上,没有任何显示,这是Logcat的新输出:
02-23 10:22:28.426 16674-16674/? I/WebViewFactory: Loading com.google.android.webview version 47.0.2526.100 (code 252610000)
02-23 10:22:28.520 16674-16674/? I/cr_LibraryLoader: Time to load native libraries: 0 ms (timestamps 8908-8908)
02-23 10:22:28.520 16674-16674/? I/cr_LibraryLoader: Expected native library version number "47.0.2526.100", actual native library version number "47.0.2526.100"
02-23 10:22:28.546 16674-16674/? I/cr_LibraryLoader: Expected native library version number "47.0.2526.100", actual native library version number "47.0.2526.100"
02-23 10:22:28.546 16674-16674/? I/chromium: [INFO:library_loader_hooks.cc(122)] Chromium logging enabled: level = 0, default verbosity = 0
02-23 10:22:28.555 16674-16674/? I/cr_BrowserStartup: Initializing chromium process, singleProcess=true
02-23 10:22:28.558 16674-16674/? E/SysUtils: ApplicationContext is null in ApplicationStatus
02-23 10:22:28.615 16674-17002/? W/cr_media: Requires BLUETOOTH permission
02-23 10:22:28.643 16674-16674/? D/cr_Ime: [InputMethodManagerWrapper.java:27] Constructor
02-23 10:22:28.652 16674-16674/? D/cr_Ime: [ImeAdapter.java:241] attach
02-23 10:22:28.661 16674-16674/? W/AwContents: onDetachedFromWindow called when already detached. Ignoring
02-23 10:22:28.662 16674-16674/? D/cr_Ime: [InputMethodManagerWrapper.java:56] isActive: false
02-23 10:22:28.666 16674-16674/? W/ResourceType: No package identifier when getting value for resource number 0x00000000
02-23 10:22:28.728 16674-16674/? D/cr_Ime: [ImeAdapter.java:241] attach
02-23 10:22:28.766 16674-16674/? D/cr_Ime: [ImeAdapter.java:241] attach
02-23 10:22:28.824 16674-16674/? D/cr_Ime: [AdapterInputConnection.java:499] finishComposingText
02-23 10:22:28.827 16674-16674/? D/cr_Ime: [AdapterInputConnection.java:145] Constructor called with outAttrs: inputType=0xa1 imeOptions=0x12000000 privateImeOptions=null
actionLabel=null actionId=0
initialSelStart=0 initialSelEnd=0 initialCapsMode=0x0
hintText=null label=null
packageName=il.co.medonline.doctorapp fieldId=-1 fieldName=null
extras=null
02-23 10:22:28.857 16674-16674/? D/cr_Ime: [AdapterInputConnection.java:308] getExtractedText
02-23 10:22:28.861 16674-16674/? D/cr_Ime: [AdapterInputConnection.java:542] setComposingRegion [0 0]
02-23 10:22:28.862 16674-16674/? D/cr_Ime: [AdapterInputConnection.java:499] finishComposingText
02-23 10:22:28.877 16674-17015/? E/libEGL: validate_display:255 error 3008 (EGL_BAD_DISPLAY)
02-23 10:22:28.957 16674-16674/? W/cr_BindingManager: Cannot call determinedVisibility() - never saw a connection for the pid: 16674
存在两条相同的不祥线:validate_display:255 error 3008
和Cannot call determinedVisibility()
。谷歌搜索这些似乎表明它们出现在应用未更新某些安全措施以与Android 5.0及更高版本中使用的Linux内核兼容的情况下,但是可以通过在本机Android WebView上设置几个属性来轻松解决。cn1是否可以访问这些内容,还是应该尝试使用本机组件?
浏览器如何布置?它可以在模拟器中工作吗?
我看到您已将其添加到边框布局中,但是如果您将该组件放置在布局管理器中而不显式增大组件,则实际上这并不重要。
本文收集自互联网,转载请注明来源。
如有侵权,请联系[email protected] 删除。
我来说两句