'Set label color for swipe on Android RecyclerView
I created a RecyclerView
with customized swipe draw functionality.
Everything works fine, except of the color of the swipe label.
Question: How can I change the color of the displayed label (not the background).
I use the following code in my activity onChildDraw
method:
new RecyclerViewSwipeDecorator.Builder(c, recyclerView, viewHolder, dX, dY, actionState, isCurrentlyActive)
.addSwipeRightBackgroundColor(ContextCompat.getColor(mActivity, R.co lor.deleteRecyclerViewItem))
.addSwipeRightActionIcon(R.drawable.ic_baseline_archive_24)
.addSwipeRightLabel(viewHolder.itemView.getContext().getString(R.string.archive))
.addSwipeLeftBackgroundColor(colorPrimary)
.addSwipeLeftLabel(viewHolder.itemView.getContext().getString(R.string.menu))
.create()
.decorate();
super.onChildDraw(c, recyclerView, viewHolder, dX, dY, actionState, isCurrentlyActive);
Everything I found was only about the background.
Solution 1:[1]
You have to add
.setSwipeLeftLabelColor(your_color)
Check customizing section. https://github.com/xabaras/RecyclerViewSwipeDecorator#customizing
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
Solution | Source |
---|---|
Solution 1 | Ryan M |