浮动蜂窝窗
如何在 Android Honeycomb 中创建一个像计算器或记事本应用程序那样的浮动窗口?
我测试过
android:theme="@android:style/Theme.Dialog"
我得到一个居中的透明活动,但问题是它不可移动并且没有关闭按钮。
How can I create a floating window in Android Honeycomb like the one of Calculator or notepad application?
I've tested with
android:theme="@android:style/Theme.Dialog"
and I get a centered transparent activity but the problem is that it isn't movable and hasn't close button.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
您显示的计算器不是 Android 的一部分。另外,Android 窗口没有这样的关闭按钮。我不知道你在看什么,但它无论如何都不是标准的 Android。
That calculator you show isn't a part of Android. Also, Android windows don't have close buttons like that. I don't know what you are looking at, but it isn't standard Android in any way shape or form.
AirCalc 可以做到https://play.google .com/store/apps/details?id=com.myboyfriendisageek.aircalc&hl=en
--编辑
只是为了添加到我之前的答案中。它不需要是设备制造商提供的自定义 API,如上面答案中提到的@hackbod。
实际上,您可以编写一个服务并向 WindowManager 添加一个布局,并将其设置为 TYPE_SYSTEM_OVERLAY,然后您的应用程序就在其他应用程序之上运行。
AirCalc can do it https://play.google.com/store/apps/details?id=com.myboyfriendisageek.aircalc&hl=en
--Edit
Just to add to my previous answer. It doesn't need to be Custom API provided by device manufacturer as @hackbod mentioned in the above answer.
You can actually write a Service and Add a Layout to the WindowManager and set it to be TYPE_SYSTEM_OVERLAY and there you go, your application is running on top of other applications.