简体   繁体   English

Android - TalkBack 辅助功能专注于 Recycleview 中的滑动删除按钮

[英]Android - TalkBack accessibility focus on swipe to delete button in Recycleview

I have drawn the Swipe to delete button(RectF) in Recycle view with the help on我在回收视图的帮助下绘制了滑动删除按钮(RectF)

 val oBackground = RectF(itemView.right.toFloat() - buttonWidth, itemView.top.toFloat(), itemView.right.toFloat(), itemView.bottom.toFloat())
    paint.color = ContextCompat.getColor(viewHolder.itemView.context, R.color.color_cc0013)
    canvas.drawRect(optionsBackground, paint)

    // Displays delete drawable within specified bounds
    val deleteBtmp: Bitmap = getBitmapFromVectorDrawable(viewHolder.itemView.context, R.drawable.vector_delete)
    val destination = RectF(
        itemView.right.toFloat() - buttonWidth + paddingLeft,
        itemView.top.toFloat() + paddingTop,
        itemView.right.toFloat() - paddingRight,
        itemView.bottom.toFloat() - paddingBottom
    )
    canvas.drawBitmap(deleteBtmp, null, destination, paint)

How I can set TalkBack accessibility focus on swipe to delete button(deleteBtmp) in Recycleview?如何在 Recycleview 中将 TalkBack 辅助功能焦点设置为滑动删除按钮(deleteBtmp)?

在此处输入图像描述

Your delete button is what we call a "virtual view".您的删除按钮就是我们所说的“虚拟视图”。 You'll need to expose it with an AccessibilityNodeProvider.您需要使用 AccessibilityNodeProvider 公开它。

ExploreByTouchHelper is a wrapper intended to simplify the process. ExploreByTouchHelper是一个旨在简化流程的包装器。

Much simpler, however, would be to adjust your UI to use a regular button, and take advantage of the built-in accessibility reporting.然而,简单的方法是将您的 UI 调整为使用常规按钮,并利用内置的可访问性报告。

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

相关问题 Android canvas object 上的对讲可访问性在 RecyclerView 中滑动以启用删除按钮 - Android Talkback accessibility on canvas object in RecyclerView swipe to enable delete button Android RecyclerView 使用删除按钮部分滑动 - Android RecyclerView Partial Swipe with Delete Button 通过滑动禁用recycleView中的几个单元格,或在滑动时隐藏删除 - disable few cells in recycleView from swipe or hide delete while swiping 从Android中的RecycleView中删除焦点指示符 - Removing focus indicator from RecycleView in Android Android - 滑动删除 RecyclerView - Android - Swipe to delete RecyclerView 在Recycler View Android中向后滑动后,无法清除部分滑动删除按钮 - Not able to clear the partial swipe delete button after swipe back in recycler view android 单击按钮将RecycleView滚动到android中的最高位置 - Rolling RecycleView to top position in android on button click 按钮未显示在Android Studio中的RecycleView下方 - Button not display below RecycleView in Android Studio 分页调用android时,无尽的Recycleview焦点在顶部 - Endless Recycleview focus at top when pagination call android 用户在Android中的RecycleView上专注于特定元素有多少时间 - How much time the user focus on specific element on RecycleView in android
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM