是否可以将布局向左移动,以便屏幕的另一侧可见?

发布于 2025-01-10 03:58:55 字数 1468 浏览 5 评论 0原文

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

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

发布评论

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

评论(1

如何视而不见 2025-01-17 03:58:55

在 MotionLayout 中,您可以在一种状态下将视图完全限制在屏幕上,而在另一种状态下将视图完全限制在屏幕外。转换会将视图“滑入”。

当人们使用 MotionLayout 执行此操作时,典型的问题是如何将“全尺寸视图”限制在屏幕边界之外。

有几种方法可以实现这一点 2 是:

  1. 使用layout_width =“match_parent”& layout_constraintLeft_toRightOf="parent"
  2. 使用layout_width="0dp" & layout_constraintLeft_toRightOf="parent" andlayout_constraintWidth_percent="1"

关键是您将视图的左侧限制到父级的右侧。

是幻灯片约束布局的示例在。

I motionLayout you would constrain the view fully on screen in one state and fully off screen in the other. Than the transition would "slide" the view in.

The typical problem when people do this with MotionLayout is how to constrain a "full size view" outside the bounds of the screen.

There are several ways to accomplish this 2 are:

  1. used layout_width="match_parent" & layout_constraintLeft_toRightOf="parent"
  2. use layout_width="0dp" & layout_constraintLeft_toRightOf="parent" andlayout_constraintWidth_percent="1"

The key is you are constraining the left side of the view to the right side of the parent.

This is an example of layout the constraints for slide in.

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