简体   繁体   English

为什么 LazyColumn 不能使用鼠标滚动,但回收器视图可以?

[英]Why is LazyColumn not scrollable using mouse but recycler view is?

This is a question of Why rather than How .这是一个Why而不是How 的问题

I am using scrcpy to mirror and control my physical test mobile device using my desktop.我正在使用scrcpy来镜像和使用我的桌面控制我的物理测试移动设备。

I am migrating an app from views to jetpack compose.我正在将应用程序从视图迁移到 jetpack compose。
This is something I observed and I am curious why this happens so.这是我观察到的事情,我很好奇为什么会这样。

Using the desktop mouse scroll wheel, I am able to scroll a RecyclerView .使用桌面鼠标滚轮,我可以滚动RecyclerView

But I am not able to do so in a LazyColumn .但我无法在LazyColumn这样做。

Note: I am able to scroll the LazyColumn using the mouse by click and drag.注意:我可以使用鼠标通过单击和拖动来滚动LazyColumn
Only the scroll wheel is not working.只有滚轮不工作。

Code (which I feel is really not relevant)代码(我觉得真的不相关)

bookingsState?.let { bookings ->
    LazyColumn(
        modifier = Modifier.fillMaxWidth(),
    ) {
        items(bookings) { booking: BookingEntity ->
            BookingView(booking)
        }
    }
}

( scrcpy author here) (这里是scrcpy作者)

scrcpy just injects scroll events , which are handled by the system: https://github.com/Genymobile/scrcpy/blob/c96f5c70e9c6fe82da059c7d24e77d9730aa7f86/server/src/main/java/com/genymobile/scrcpy/Controller.java#L225-L246 scrcpy只注入由系统处理的滚动事件https : //github.com/Genymobile/scrcpy/blob/c96f5c70e9c6fe82da059c7d24e77d9730aa7f86/server/src/main/java/com/genymobile/scrcpy2L4L25

However, the problem might still be explained by incorrect parameters in the scroll event, which happen to work in many case but not all.但是,问题仍然可能是由滚动事件中的错误参数来解释的,这在很多情况下都有效,但不是全部。 Such problems already occurred in the past: https://github.com/Genymobile/scrcpy/issues/2169此类问题过去已经发生: https : //github.com/Genymobile/scrcpy/issues/2169

In particular, scroll events are injected with a touchscreen as input device, which is probably incorrect.特别是,滚动事件是通过触摸屏作为输入设备注入的,这可能是不正确的。 Could you please try with this fix: https://github.com/Genymobile/scrcpy/commit/13b8fc0ad9376409a1c93194c6f7c491e51c533d你能试试这个修复吗: https : //github.com/Genymobile/scrcpy/commit/13b8fc0ad9376409a1c93194c6f7c491e51c533d

Here is a binary to replace in your v1.18 release so you can test easily:scrcpy-server (SHA256: a1db961faf8f567737373f1fa9f39609fede8955b5b28c3f31a06256f54d33d1)这是要在scrcpy-server版本中替换的二进制文件,以便您可以轻松测试:scrcpy-server (SHA256: a1db961faf8f567737373f1fa9f39609fede8955b5b28c3f31a06256f54d33d1)

Thank you for your feedback.感谢您的反馈意见。


The problem is the same with a mouse (connected via bluetooth), without scrcpy being involved at all: https://github.com/Genymobile/scrcpy/issues/2602#issuecomment-907686669问题与鼠标(通过蓝牙连接)相同,根本不涉及 scrcpy: https : //github.com/Genymobile/scrcpy/issues/2602#issuecomment-907686669

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM