Android:如何使用片段中的浮动RecyclerView创建叠加层 [英] Android: How do I create an overlay with a floating RecyclerView within a fragment

查看:192
本文介绍了Android:如何使用片段中的浮动RecyclerView创建叠加层的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我不太清楚我应该搜索什么,所以我以为我会询问是否有人可以1)帮助我识别我正在创建的是什么,或者2)给我一个图书馆的想法/我将如何去创造这个。



看到这个(画面不好)的图片:



我想要做的是创建一个正常的片段,其中包含正常的内容,但是当您按某个按钮(IE操作栏)时,它会创建一个浮动作为一种叠加在您的片段之上。理想情况下,如果用户点击其他地方,它将关闭它(所以它应该模拟一个可以忽略的对话框的行为),但也允许在视图本身内单击。



另外,如果可能,我想在+号和回收器视图之间建立一个连接(像一行或某些东西),只是为了表明它是连接的,是一个叠加层任何人都有任何建议,我应该做什么或我应该寻找什么?



谢谢!



-Sil

解决方案

您可以将RecyclerView放在一个 DialogFragment 。这样,您可以获得叠加感,当用户点击任何位置时,您也可以关闭它。


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:

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

解决方案

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.

这篇关于Android:如何使用片段中的浮动RecyclerView创建叠加层的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆