Android 中可关闭的横幅

发布于 2024-09-05 02:29:28 字数 200 浏览 3 评论 0原文

我想在 Android 活动中显示横幅。

横幅应该是:

  • 在布局的底部对齐
  • 占据所有宽度并具有相对高度(例如 100dip)
  • 可关闭

当关闭时,布局的其余部分应拉伸以填充横幅占据的区域。

在 Android 中实现此功能的最佳方法是什么?

谢谢!

I would like to show a banner in an Android activity.

The banner should be:

  • Aligned at the bottom of the layout
  • Take all the width and have relative height (say 100dip)
  • Be dismissable

When dismissed the rest of the layout should strech to fill the area that was occupied by the banner.

What's the best way to implement this in Android?

Thanks!

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

陪你搞怪i 2024-09-12 02:29:28

您可以设置一个Animation来向下滑动横幅,当它离开视图时(设置一个onAnimationComplete侦听器)调用它的方法:setVisibility(View. GONE) 因此它不会再占用布局空间。

you can set up an Animation to slide the banner down, and when it's out of the view (setup a onAnimationComplete listener) call it's method : setVisibility(View.GONE) so it will not take up space in layout any more.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文