gpt4 book ai didi

android - ImageSwitcher 究竟做了什么?

转载 作者:塔克拉玛干 更新时间:2023-11-02 20:52:22 26 4
gpt4 key购买 nike

我正在尝试改进我的 Android 应用程序,我看到 ImageSwitcher 被大量引用用于各种动画任务,但谷歌文档完全是简陋的,除了其中的方法外没有描述任何内容类。同时例子中都使用了gallery,不解释原因。

是否有人链接到(或愿意解释)关于该类实际做什么以及如何使用它的任何信息?

最佳答案

我没用过,所以无法给出明确的答案。我最好的猜测来自于沿着继承链的工作......

ViewAnimator ...

Base class for a FrameLayout container that will perform animations when switching between its views.

ViewSwitcher

ViewAnimator that switches between two views, and has a factory from which these views are created. You can either use the factory to create the views, or add them yourself. A ViewSwitcher can only have two child views, of which only one is shown at a time.

然后查看 ViewSwitcher 的另一个直接子类...

TextSwitcher

Specialized ViewSwitcher that contains only children of type TextView. A TextSwitcher is useful to animate a label on screen. Whenever setText(CharSequence) is called, TextSwitcher animates the current text out and animates the new text in.

所以从字里行间看,一个ImageSwitcherViewAnimator它针对图像(即可绘制对象)进行了优化,并且直接继承自 ViewSwitcher它只能有两个图像。

因此,解释 TextSwitcher概述,我会说...

每当<insert setImageXXX method here>被调用时,ImageSwitcher 动画输出当前图像并动画输入新图像。

正如我所说,这只是“最佳猜测”。

关于android - ImageSwitcher 究竟做了什么?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/6398653/

26 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com