Ost*_*tan 47 android webview android-webview android-4.2-jelly-bean
我的应用程序使用了许多Web视图,这些web视图位于由ViewPager保存的片段中.
每当我使用Jellybean在我的Galaxy Nexus上轻扫应用程序时,我会一次又一次地收到以下控制台消息:
08-23 13:44:03.374: E/webcoreglue(21690): Should not happen: no rect-based-test nodes found
Run Code Online (Sandbox Code Playgroud)
任何人都可以向我解释这里出了什么问题,以便我可以解决这个问题吗?
小智 21
出现此问题是因为在某些情况下,WebView无法注意到其可见的rect已更改,因此就webkit而言,页面仍然不可见.因此,所有触摸都落在窗外,并被拒绝.
最干净的解决方法是当您知道WebView的可见性发生变化时(例如响应来自viewpager的setPrimaryItem回调), webview.onScrollChanged(webview.getScrollX(), webview.getScrollY());
您需要将webview子类化,以将受保护的onScrollChanged提升为公共方法.
Cod*_*sed 18
我有这个问题.问题正是Rahul Dole在上面的回答中所说的.
我花了几天时间尝试了很多不同的东西.我注意到当方向改变时,可见的WebView onLongClick再次工作......所以我想出了这个小宝石.确实它非常hacky但它的工作原理!
在扩展WebView的类中使用它:
@Override
public boolean onTouchEvent(MotionEvent event) {
if (event.getAction() == MotionEvent.ACTION_DOWN){
int temp_ScrollY = getScrollY();
scrollTo(getScrollX(), getScrollY() + 1);
scrollTo(getScrollX(), temp_ScrollY);
}
return super.onTouchEvent(event);
}
Run Code Online (Sandbox Code Playgroud)
Rah*_*ole 16
我遇到了完全相同的问题.在我的应用程序中,无论我在jquery bind()中使用'touchend'编码的点击事件,这个错误都会出现,它过去常常从不响应点击(点击)...并给出了一种冷冻的感觉.所以我只是尝试用bind()中的'click'替换'touchend',它有效!响应点击(点击)并且也没有显示webcoreglue的日志条目..
我还在Android的webview代码中找到了这段代码.
HTMLElement* WebViewCore::retrieveElement(int x, int y,
const QualifiedName& tagName)
{
HitTestResult hitTestResult = m_mainFrame->eventHandler()
->hitTestResultAtPoint(IntPoint(x, y), false, false,
DontHitTestScrollbars, HitTestRequest::Active | HitTestRequest::ReadOnly,
IntSize(1, 1));
if (!hitTestResult.innerNode() || !hitTestResult.innerNode()->inDocument()) {
LOGE("Should not happen: no in document Node found");
return 0;
}
const ListHashSet<RefPtr<Node> >& list = hitTestResult.rectBasedTestResult();
if (list.isEmpty()) {
LOGE("Should not happen: no rect-based-test nodes found");
return 0;
}
Node* node = hitTestResult.innerNode();
Node* element = node;
while (element && (!element->isElementNode()
|| !element->hasTagName(tagName))) {
element = element->parentNode();
}
DBG_NAV_LOGD("node=%p element=%p x=%d y=%d nodeName=%s tagName=%s", node,
element, x, y, node->nodeName().utf8().data(),
element ? ((Element*) element)->tagName().utf8().data() : "<none>");
return static_cast<WebCore::HTMLElement*>(element);
}?
Run Code Online (Sandbox Code Playgroud)
这也是..
// get the highlight rectangles for the touch point (x, y) with the slop
Vector<IntRect> WebViewCore::getTouchHighlightRects(int x, int y, int slop)
{
Vector<IntRect> rects;
m_mousePos = IntPoint(x - m_scrollOffsetX, y - m_scrollOffsetY);
HitTestResult hitTestResult = m_mainFrame->eventHandler()->hitTestResultAtPoint(IntPoint(x, y),
false, false, DontHitTestScrollbars, HitTestRequest::Active | HitTestRequest::ReadOnly, IntSize(slop, slop));
if (!hitTestResult.innerNode() || !hitTestResult.innerNode()->inDocument()) {
LOGE("Should not happen: no in document Node found");
return rects;
}
const ListHashSet<RefPtr<Node> >& list = hitTestResult.rectBasedTestResult();
if (list.isEmpty()) {
LOGE("Should not happen: no rect-based-test nodes found");
return rects;
}
//Rest of the part is omitted here...
Run Code Online (Sandbox Code Playgroud)
请注意那里的日志消息?我猜测这段代码用于识别点击或点击或滑动时生成的x和y轴向量.
| 归档时间: |
|
| 查看次数: |
22363 次 |
| 最近记录: |