在Android OREO中更新API(27)后,此代码不再有效:
public void onPageFinished(WebView view, String url) {
super.onPageFinished(view, url);
view.loadUrl("javascript:(function() {document.getElementById(\"imPage\").style.display='none';})()");
}
Run Code Online (Sandbox Code Playgroud)
我也尝试过:
webView.loadUrl(
"javascript:(function() { " +
"document.addEventListener(\"DOMContentLoaded\", function(event) {" +
"document.getElementById(\"imPage\").style.display='none';" +
"});" +
"})()");
Run Code Online (Sandbox Code Playgroud)
元素未隐藏和调试返回:
I/chromium: [INFO:CONSOLE(1)] "Uncaught TypeError: Cannot read property 'style' of null", source: mywebsite/ (1)
Run Code Online (Sandbox Code Playgroud)
所以我认为javascript在加载页面之前注入,这解释了为什么行为1,因为我在加载页面完成后调用了其他代码,但是当页面为白色而未加载时调用此代码.
昨天我将模拟器更新到27.0.2,今天更新到27.0.3
https://developer.android.com/studio/releases/emulator.html
但是在27.0.2之后,任何版本的Android和Device的所有Emulator都会显示白屏.
我真的很绝望,我不知道怎么做.


我试图在带有双引号的静态字符串中插入动态字符串,还试过如何将双引号添加到变量内的字符串中?但在我的情况下没有任何作用:
startInfo.Arguments = @"/C = """+service+""" >nul 2>&1";
Run Code Online (Sandbox Code Playgroud)
service是动态字符串,我需要这个结果:
"/C = "mystring" >nul 2>&1";
Run Code Online (Sandbox Code Playgroud)
没有动态变量我使用双引号它工作,我需要@为静态路径
"/C = ""static"" >nul 2>&1";
Run Code Online (Sandbox Code Playgroud)
我有以下这段文字file_get_contents('php://input'):
[{"email":"text@examlple.com","event":"processed","sg_event_id":"JJTr9qA","sg_message_id":"AjvX5L7IQeGOfxmJV-OCnw","smtp-id":"<AfxmJV-OCnw@ismon1.sendgrid.net>","timestamp":16813363}]
Run Code Online (Sandbox Code Playgroud)
我需要获取电子邮件或事件之类的单个元素,但无法获取json_decode,其他人也无法使用。
$obj = json_decode(file_get_contents('php://input'));
Run Code Online (Sandbox Code Playgroud)
如何引用json数据中的单个元素?
我创建了一个小应用程序,但仅在 Android 6 上崩溃,由 android studio 在第一个活动抽屉中创建的这行代码:
setContentView(R.layout.activity_home);
Run Code Online (Sandbox Code Playgroud)
错误:
java.lang.RuntimeException: Unable to start activity ComponentInfo{com.application/com.application.Home}: android.view.InflateException: Binary XML file line #16: Binary XML file line #16: Error inflating class android.support.design.widget.NavigationView
Run Code Online (Sandbox Code Playgroud)
详细错误:
Caused by: android.view.InflateException: Binary XML file line #16: Binary XML file line #16: Error inflating class android.support.design.widget.NavigationView
at android.view.LayoutInflater.inflate(LayoutInflater.java:539)
Run Code Online (Sandbox Code Playgroud)
该应用程序仅在此设备/android 6 上崩溃,android 7 和 8 没有问题,代码在任何方面都是正确的,例如:
<application
android:allowBackup="true"
android:icon="@drawable/logo"
android:label="@string/app_name"
android:roundIcon="@drawable/logo"
android:supportsRtl="true"
android:hardwareAccelerated="true"
android:theme="@style/AppTheme">
<activity
android:name=".Home"
android:keepScreenOn="true"
android:label="@string/app_name"
android:screenOrientation="portrait"
android:theme="@style/AppTheme.NoActionBar">
Run Code Online (Sandbox Code Playgroud)
和同样完美的 xml 代码:
<?xml version="1.0" encoding="utf-8"?>
<android.support.design.widget.CoordinatorLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto" …Run Code Online (Sandbox Code Playgroud)