简体   繁体   English

Android-对话框片段顶部的浮动操作按钮

[英]Android - Floating action button on top of Dialog Fragment

I've got a Floating Action Button and when I click on it I open a DialogFragment . 我有一个“ Floating Action Button ,当我单击它时,打开一个DialogFragment When the dialog is opened, the button is below the dialog. 打开对话框时,该按钮位于对话框下方。 My question is, how do I position the button after the onclick event on top of the DialogFragment ? 我的问题是,如何将按钮放置在DialogFragment顶部的onclick事件之后?

Well, I would do this trick : use Fragment and adjust it to look like dialog( you even can use dialog fragment theme ). 好吧,我会做到这一点:使用Fragment并对其进行调整以使其看起来像dialog(甚至可以使用dialogfragment theme)。 Then use the same FAB on fragment layout ( Even better you can make transition view for fab. something like zoom out/in )... Here is the complete example uploaded on Github for you :-) 然后在片段布局上使用相同的FAB(甚至更好的是,可以为fab制作过渡视图。类似zoom / in的东西)...这是在Github上为您上传的完整示例:-)

https://github.com/mabuthraa/Android-FabOverDialog https://github.com/mabuthraa/Android-FabOverDialog

I will try later to improve that example by using Fragment theme and transition. 稍后,我将尝试通过使用Fragment主题和过渡来改进该示例。

Good luck,'. 祝好运,'。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM