[英]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.