android - 如何在 Kotlin 中设置 ViewDragHelper 灵敏度?
问题描述
我在 Kotlin 中使用 SwipeBackActivity 库。该库在滑动活动时使用 ViewDragHelper。这是这个库中的一些代码;
private final androidx.customview.widget.ViewDragHelper viewDragHelper;
private class ViewDragHelperCallBack extends androidx.customview.widget.ViewDragHelper.Callback {
private ViewDragHelperCallBack() { /* compiled code */ }
public boolean tryCaptureView(android.view.View child, int pointerId) { /* compiled code */ }
public int getViewVerticalDragRange(android.view.View child) { /* compiled code */ }
public int getViewHorizontalDragRange(android.view.View child) { /* compiled code */ }
public int clampViewPositionVertical(android.view.View child, int top, int dy) { /* compiled code */ }
public int clampViewPositionHorizontal(android.view.View child, int left, int dx) { /* compiled code */ }
public void onViewDragStateChanged(int state) { /* compiled code */ }
public void onViewPositionChanged(android.view.View changedView, int left, int top, int dx, int dy) { /* compiled code */ }
public void onViewReleased(android.view.View releasedChild, float xvel, float yvel) { /* compiled code */ }
}
我想设置拖动灵敏度。有人就来自 github 的问题写了这段代码。
viewDragHelper = ViewDragHelper.create(this, 0.1f, new ViewDragHelperCallBack());
但我找不到如何使用此代码。如何在 Kotlin 中定义 viewDragHelper?如何在我的项目中设置 viewDragHelper?
解决方案
推荐阅读
- elasticsearch - Why elasticsearch returns too different results for the same query on different indices?
- ios - How to get current request connect server ip addres
- java - How to collect user entered variables for database storage
- vue.js - 如何将 javascript 标签文件添加到 Vue
- javascript - Javascript - is an anonymous function used as a callback created multiple times?
- python - 如何将这些输出转换为矩阵格式
- javascript - For a positive integer n, is Math.random()*n >= n possible?
- node.js - (节点:11340)DeprecationWarning:collection.findAndModify 已弃用。改用 findOneAndUpdate、findOneAndReplace 或 findOneAndDelete
- sql - SQL Server : retrieving stored procedure errors and use them
- jquery - 更改关闭的 div 按钮的文本