小编Sha*_*evy的帖子

HTML滚动事件在ScrollView内部的Android WebView中

我有一个用于测试目的的网页(https://storage.googleapis.com/htmltestingbucket/nested_scroll_helper.html),它只打印html在固定标题中捕获的滚动事件的计数器

当Android WebView是片段中唯一可滚动的元素时,一切都很好,WebView将滚动事件发送到页面

如果我想在WebView的上方和下方添加原生元素,那么事情会变得复杂得多.

<ScrollView xmlns:android="http://schemas.android.com/apk/res/android"
    xmlns:custom="http://schemas.android.com/apk/res-auto"
    android:layout_width="match_parent"
    android:layout_height="match_parent">

    <LinearLayout
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:orientation="vertical">

        <TextView
            android:layout_width="match_parent"
            android:layout_height="wrap_content"
            android:padding="20dp"
            android:text="SOMETHING ABOVE THE WEBVIEW" />

        <WebView
            android:id="@+id/webview"
            android:layout_width="match_parent"
            android:layout_height="match_parent" />

        <TextView
            android:layout_width="match_parent"
            android:layout_height="wrap_content"
            android:padding="20dp"
            android:text="SOMETHING BELOW THE WEBVIEW" />

    </LinearLayout>
</ScrollView>
Run Code Online (Sandbox Code Playgroud)

我知道在ScrollView中使用WebView并不好,但我必须在html文档中提供混合内容和正确滚动事件的单一滚动体验.我发现了很多关于此事的问题,但我能够创建一个完整的端到端解决方案


此外,我知道lint有一个官方的检查:

NestedScrolling ---------------摘要:嵌套滚动小部件

优先级:7/10严重性:警告类别:正确性

滚动窗口小部件(如ScrollView)不应包含任何嵌套滚动窗口小部件,因为它具有各种可用性问题

然而,我无法在本机中实现Web视图内容,因此我需要另一种方法来实现

android webview android-scrollview

12
推荐指数
1
解决办法
5099
查看次数

禁用ActionBar RTL方向

Android 4.2引入了RTL(BiDi)支持,开始使用它我只需按照说明(android:supportsRtl属性到清单文件中的元素并将其设置为"true")

但是,我的ActionBar徽标也会改变方向(右侧显示徽标),这是我不想要的.我确实想使用RTL功能,但将ActionBar保持在左侧...

换句话说,当语言方向为RTL时,如何使用android:supportsRtl属性而不更改Android 4.2上的ActionBar方向

有什么建议 ?

android bidi android-layout right-to-left

9
推荐指数
2
解决办法
5119
查看次数

例外:回调必须在populateNodeForVirtualViewId()中设置父界限

我的Android应用崩溃报告服务报告了许多实例:

java.lang.RuntimeException: Callbacks must set parent bounds in populateNodeForVirtualViewId()
at iv.a(SourceFile:56)
at iw.a(SourceFile:716)
at hq.a(SourceFile:112)
at hw.createAccessibilityNodeInfo(SourceFile:42)
at android.view.AccessibilityInteractionController$AccessibilityNodePrefetcher.prefetchAccessibilityNodeInfos(AccessibilityInteractionController.java:724)
at android.view.AccessibilityInteractionController.findAccessibilityNodeInfoByAccessibilityIdUiThread(AccessibilityInteractionController.java:147)
at android.view.AccessibilityInteractionController.access$300(AccessibilityInteractionController.java:49)
at android.view.AccessibilityInteractionController$PrivateHandler.handleMessage(AccessibilityInteractionController.java:971)
at android.os.Handler.dispatchMessage(Handler.java:102)
at android.os.Looper.loop(Looper.java:136)
at android.app.ActivityThread.main(ActivityThread.java:5140)
at java.lang.reflect.Method.invokeNative(Native Method)
at java.lang.reflect.Method.invoke(Method.java:515)
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:795)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:611)
at dalvik.system.NativeStart.main(Native Method)
Run Code Online (Sandbox Code Playgroud)

连接到辅助功能问题的感觉我没有真正关心,但我该如何开始修复它?调用堆栈并没有指向任何方向

我尝试将contentDescpription xml标记添加到我的代码中的所有位置,lint告诉我它已丢失,但它没有帮助

编辑:发现问题,当我通过触摸探测(对话?)启用时,我在地图片段上方显示StreetViewPanoramaFragment时发生了崩溃.

我不知道造成这种情况的原因,我想我会打开一个单独的更集中的问题

android runtimeexception

8
推荐指数
1
解决办法
641
查看次数