Tooltip in Items within RecyclerView (Overlap above items)

大兔子大兔子 提交于 2020-06-11 06:22:24

问题


I need to create a RecyclerView with multiple ViewTypes. However, on some of the items, I need to display a Tooltip which should hover over the above row.

My requirement is:

In the above image, there are 4 items in the RecyclerView, and the tooltip in the lower row should overlap on top of the above row (or rows, as required). This tooltip would only be visible in some scenarios - when the lock icon is visible.

The problem is, if I add this tooltip as a TextView to the row_layout.xml, and control it's visibility programmatically, it increases the height of that row and does not overlap onto the above layout.

How can I get this view to "hover" over the above rows without displacing them?

If you require code, I can edit this question and post the code too (but I think it might not be necessary here).


回答1:


You can make use of Android Tooltips library.

Simple to use customizable Android Tooltips library based on PopupWindow. This Tooltips does not require any custom layout. It works as PopupWindow.

dependencies {
    compile 'com.github.vihtarb:tooltip:0.1.9'
}

usage:

Tooltip tooltip = new Tooltip.Builder(anchorView)
    .setText("Hello tooltip")
    .show();



回答2:


Dont know if it will work for recycler view ,but for list view you can use quick action item, complete article is over here also look at these Libraries some of them may work for recyclerview




回答3:


You could use this library Super Tooltips

It is simple to use and powerful.



来源:https://stackoverflow.com/questions/41804545/tooltip-in-items-within-recyclerview-overlap-above-items

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!