android:clipChildren 仍然有效吗?

发布于 2024-10-12 17:28:00 字数 306 浏览 4 评论 0原文

android:clipChildren 仍然有效吗? 我有一个具有大小的 AbsoluteLayout 并将 ClipChildren 设置为 false。当我添加比 AbsoluteLayout 更大的子元素时,子元素仍然被剪裁。

有人能做到这一点吗?

使用Android 2.2(API级别8)


更新20-01-11:

我可以用RelativeLayout做一些类似的事情,但是android:clipChildren可以工作吗? 顺便说一句,我的应用程序不需要在 Android 2.2 之外的任何其他平台上运行。

Does the android:clipChildren still works?
I have a AbsoluteLayout with a size and set the clipChildren to false. When I add childeren that are bigger then the AbsoluteLayout the childeren are still clipped.

Anyone got this working?

Working with Android 2.2 (API level 8)


Update 20-01-11:

I can make something similiar with a RelativeLayout, but does the android:clipChildren work on that?
btw, it's not needed that my application needs to work on any other platform then Android 2.2.

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

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

发布评论

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

评论(2

雨的味道风的声音 2024-10-19 17:28:00

绝对布局已被弃用。我建议使用不同的东西。

此类已被弃用。使用
FrameLayout、RelativeLayout 或
改为自定义布局。

http://developer.android.com/reference/android/widget/AbsoluteLayout。 html

编辑:回答您的评论:

被弃用意味着由于某种原因,他们停止了开发它。也许有更好的替代品,也许他们不喜欢它的工作方式。不管怎样,他们可能会在未来的版本中放弃这个布局(这意味着你的应用程序将无法在未来版本的 Android 中运行)。

替代方案:

框架布局:

FrameLayout 的设计是为了遮挡
屏幕上显示的区域
单个项目。您可以添加多个
子级到 FrameLayout,但所有
孩子们被钉在左上角
屏幕。孩子们被画在一个
堆栈,其中包含最近添加的
孩子在上面。镜框尺寸
布局是其最大的尺寸
子项(加上填充),可见或不可见
(如果 FrameLayout 的父级允许)。
消失的视图用于
仅当以下情况时才调整尺寸
setConsiderGoneChildrenWhenMeasuring()
设置为 true。

http://developer.android.com/reference/android/widget/FrameLayout。 html

相对布局

您还可以使用相对布局。将每个视图与其父视图对齐,并根据需要设置左边距和上边距。 这可能是您最好的选择 IMO。我以前曾经这样做过并且效果相当好。

Absolute layout is deprecated. I suggest using something different.

This class is deprecated. Use
FrameLayout, RelativeLayout or a
custom layout instead.

http://developer.android.com/reference/android/widget/AbsoluteLayout.html

Edit: Answering to your comment:

Being deprecated means that for some reason, they stopped developing it. Maybe there's a better replacement, maybe they don't like the way it works. Anyway, they may drop this layout in future versions (which means your app won't be able to run in a future version of android).

Alternatives:

Frame Layout:

FrameLayout is designed to block out
an area on the screen to display a
single item. You can add multiple
children to a FrameLayout, but all
children are pegged to the top left of
the screen. Children are drawn in a
stack, with the most recently added
child on top. The size of the frame
layout is the size of its largest
child (plus padding), visible or not
(if the FrameLayout's parent permits).
Views that are GONE are used for
sizing only if
setConsiderGoneChildrenWhenMeasuring()
is set to true.

http://developer.android.com/reference/android/widget/FrameLayout.html

Relative Layout

You can also use a relative layout. Align every view by it's parent and set left and top margins as you wish. This may be your best option IMO. I've done this before and it worked reasonably well.

一片旧的回忆 2024-10-19 17:28:00

正如 Pedro 所说,此功能可能是在 AbsoluteLayout 弃用后添加的,因此如果尚未实现,它将永远无法工作。

至于评论“这意味着你的应用程序将无法在未来版本的 Android 中运行”,谷歌承诺永远不会出现这种情况。

黛安·哈克伯恩

2009 年 5 月 4 日星期一上午 10:00,
太阳狗写道:

<块引用>

我有一个评价很高的应用程序,它只是...可能...不...是...
编写...没有 AbsoluteLayout,无论谁的 Java 敏感性
它继续前进。我猜 Android 在应用程序方面做得很好,它可以
有能力关闭整个类别的游戏。

AbsoluteLayout从1.5开始消失了吗?
不,你无法编写 1.5 应用程序吗?
使用它?不,我们曾经说过我们
有计划完全删除它
在未来的任何时候?不,你
需要找到更好的理由
受害者。如果你找不到一个,让
我们知道您的应用程序的名称,并且我们
可以确保在下一次打破它
发布。然后你就可以-真的-
投诉!
-- Dianne Hackborn
Android 框架工程师
[电子邮件受保护]

及以后:

我再说一遍:我们不会
从 future 中删除 AbsoluteLayout
释放,但我们强烈反对
人们不再使用它。

我想说它不会被删除是一个安全的赌注,但它也不会获得新的功能/修复。

As Pedro said, this feature may have been an addition that came after AbsoluteLayout's deprecation, so if it's not implemented already, it will never work.

As far as the comment "which means your app won't be able to run in a future version of android", Google has promised that this will NEVER be the case.

Dianne Hackborn

On Mon, May 4, 2009 at 10:00 AM,
Sundog wrote:

I have a highly rated app that simply... could... not... be...
written... without AbsoluteLayout, no matter whose Java sensibilities
it steps on. I guess Android's doing so well with apps that it can
afford to shut down an entire category of games.

Did AbsoluteLayout disappear from 1.5?
No. Are you unable to write 1.5 apps
using it? No. Have we ever said we
have any plan to completely remove it
at any point in the future? No. You
need to find better reasons to be a
victim. If you can't find one, let
us know the name of your app and we
can make sure to break it in the next
release. Then you can -really-
complain!
-- Dianne Hackborn
Android framework engineer
[email protected]

and later:

I'll say again: we are not going to
remove AbsoluteLayout from a future
release, but we strongly discourage
people from using it.

I'd say it's a safe bet to say it won't be removed, but it also won't get new features/fixes either.

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