除此之外是否有区别:
apply from: - 从URL获取(插件).gradle
apply plugin: - 从gradle插件服务器获取(插件).gradle
有没有办法以编程方式滚动到WebView中显示的HTML元素?
WebView API仅提供scrollTo(x,y)方法,但我找不到确定显示元素位置的方法.
解
使用Javascript:
webView.getSettings().setJavaScriptEnabled(true);
webView.loadUrl("javascript:document.getElementById('id').scrollIntoView();");
Run Code Online (Sandbox Code Playgroud) 我试图在获得锁定时解决并发问题,代码如下所示:
一旦线程启动就会获得真正的锁定,这已经太晚了.
acquireLockAndRunOnNewThread(() -> {
acquiredLock=true;
continueWithOtherStuff();
}
//do not continue until the lock is acquired
while(acquiredLock==false){
Thread.sleep(100);
}
continueWithOtherStuffThatAlsoAcquiresALockAtSomePointInTime()
Run Code Online (Sandbox Code Playgroud)
如果没有thread.sleep,我怎样才能正确解决这个问题?