Android: How do I create an overlay with a floating RecyclerView within a fragment

时间:2015-09-01 22:25:29

标签: android android-fragments dialog overlay android-recyclerview

I am not quite sure what I should be searching for, so I thought I would ask if anyone could 1) Help me identify the NAME of what it is I am trying to create or 2) give me an idea of a library / how I would go about creating this.

See this (Poorly-drawn) picture: enter image description here

What I am trying to do is to create a normal Fragment which has normal content in it, but when you press a button somewhere (IE action bar), it creates a recyclerview that is "floating" as a type of overlay on top of your fragment. Ideally if the user clicks elsewhere, it will close it (So it should simulate the behavior of a dismissible dialog box), but also allow clicking within the view itself.

Also, if possible, I want to make a connection between the + sign and the recyclerview (Like a line or something) just to indicate it is connected and is an overlay.

Anyone have any recommendations as to what I should do or what I should be looking for? Thanks!

-Sil

1 个答案:

答案 0 :(得分:2)

You can place your RecyclerView within a DialogFragment. That way you can get the overlay feel, and you can also dismiss it when user clicks anywhere outside of it.