简体   繁体   English

ACTION_MOVE上的重叠式布局(类似聊天工具的聊天气泡)退出布局

[英]Overlay layout (messenger-like chat bubbles) exit layout on ACTION_MOVE

recently I developed application following this tutorial: https://medium.com/exploring-code/create-chat-heads-like-facebook-messenger-32f7f1a62064 最近,我根据本教程开发了应用程序: https : //medium.com/exploring-code/create-chat-heads-like-facebook-messenger-32f7f1a62064

What it doesn't cover is how do you implement "exit layout" being drew at the bottom - middle. 它没有涵盖的是您如何实现绘制在底部(中间)的“出口布局”。 It works this way - if you drag your overlay layout on top of this "exit layout" it vibrates and upon ACTION_DOWN it stops the service that is responsible for drawing overlay layout. 它是这样工作的-如果将叠加层布局拖到此“退出布局”的顶部,则它会振动,并且在ACTION_DOWN时,它将停止负责绘制叠加层布局的服务。 I've found exactly the same "exit layout" in other apps than Messenger, so I wonder maybe it is drew by system? 我在Messenger以外的其他应用程序中发现了完全相同的“退出布局”,所以我想知道它是否是系统绘制的?

Two extra questions: 另外两个问题:

1) I was not able to draw my layout with negative X value (which would result with a effect that feels like overlay layout is really glued to the left or right edge of the screen (negative margin) - any ideas on that one? 1)我无法以负X值绘制布局(这会产生一种效果,就像叠加布局确实粘在屏幕的左边缘或右边缘(负边距)一样)-关于这一点有什么想法吗?

2) In order to make overlay layout working I had to change the target API from 27 to 25 along with BuildSystem - I am wondering what could be the possible downside of this 'workaround'. 2)为了使覆盖布局正常工作,我不得不将目标API和BuildSystem一起从27更改为25-我想知道这种“解决方法”的可能缺点是什么。 Maybe there is better solution for that one? 也许对此有更好的解决方案?

Thanks for all the responses! 感谢您的所有回复!

我通过操纵布局视图的x值(粘贴到左边缘的负值,粘贴到右边缘的正值)实现了1。

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

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