public class Fade
extends Visibility
| java.lang.Object | |||
| android.transition.Transition | |||
| android.transition.Visibility | |||
| android.transition.Fade | |||
此转换跟踪更改为开始和结束场景中目标视图的可见性,并在视图变为可见或不可见时淡入视图。 可见性由视图的setVisibility(int)状态以及它是否在当前视图层次结构中确定。
这种转换淡化特定视图的能力以及淡化操作发生的方式是基于视图层次结构中视图的情况。 例如,如果简单地从其父视图中删除视图,则视图将在淡入淡出时被添加到ViewGroupOverlay 。 如果可见视图更改为GONE或INVISIBLE ,则在动画期间可见性将更改为VISIBLE 。 但是,如果某个视图处于也正在改变其可见性的层次结构中,则情况会更加复杂。 一般来说,如果结束场景中不再处于层次结构中的视图仍然有父项(因此其父层次结构已被删除,但未从其父项中移除),则它将被单独放置以避免副作用不恰当地将其从其父母移除。 唯一的例外是,如果前面的Scene是created from a layout resource file ,那么取消父开始场景视图以使其淡出它被认为是安全的。
通过使用标签 fade以及标准属性 Fade和 Transition ,可以在资源文件中描述淡入淡出转换。
Inherited XML attributes |
|
|---|---|
android.transition.Visibility
|
|
android.transition.Transition
|
|
常量(Constants) |
|
|---|---|
int |
IN 在 |
int |
OUT 在 |
Inherited constants |
|---|
android.transition.Visibility
|
android.transition.Transition
|
Public constructors |
|
|---|---|
Fade() 构造淡入淡出过渡,淡入淡出目标。 |
|
Fade(int fadingMode) 根据fadingMode的值构造淡入淡出过渡,淡入淡出过程将淡入淡出目标。 |
|
Fade(Context context, AttributeSet attrs) |
|
公共方法(Public methods) |
|
|---|---|
void |
captureStartValues(TransitionValues transitionValues) 捕获此转场监视的属性在开始场景中的值。 |
Animator |
onAppear(ViewGroup sceneRoot, View view, TransitionValues startValues, TransitionValues endValues) 此方法的默认实现将返回空Animator。 |
Animator |
onDisappear(ViewGroup sceneRoot, View view, TransitionValues startValues, TransitionValues endValues) 此方法的默认实现将返回空Animator。 |
继承方法(Inherited methods) |
|
|---|---|
android.transition.Visibility
|
|
android.transition.Transition
|
|
java.lang.Object
|
|
int IN
在Fade(int)使用的衰落模式使转换对出现的目标进行操作。 也许可以结合OUT淡入淡出。 相当于MODE_IN 。
常数值:1(0x00000001)
int OUT
在Fade(int)使用的衰落模式使转换对正在消失的目标进行操作。 也许可以结合IN淡入淡出。 相当于MODE_OUT 。
常量值:2(0x00000002)
Fade (int fadingMode)
根据fadingMode的值构造淡入淡出过渡,淡入淡出过程将淡入淡出目标。
| 参数(Parameters) | |
|---|---|
fadingMode |
int: The behavior of this transition, a combination of IN and OUT. |
Fade (Context context, AttributeSet attrs)
| 参数(Parameters) | |
|---|---|
context |
Context
|
attrs |
AttributeSet
|
void captureStartValues (TransitionValues transitionValues)
捕获此转场监视的属性在开始场景中的值。 这些值随后将作为startValues结构传递给createAnimator(ViewGroup, TransitionValues, TransitionValues) 。 实施的主要关注点是过渡期关注的属性以及所有这些属性的价值。 开始和结束值将在createAnimator(android.view.ViewGroup, TransitionValues, TransitionValues)方法后期进行比较,以确定应该运行哪些动画(如果有的话)。
子类必须实现此方法。 该方法只能由过渡系统调用; 它不打算从外部类中调用。
| 参数(Parameters) | |
|---|---|
transitionValues |
TransitionValues: The holder for any values that the Transition wishes to store. Values are stored in the values field of this TransitionValues object and are keyed from a String value. For example, to store a view's rotation value, a transition might call transitionValues.values.put("appname:transitionname:rotation", view.getRotation()). The target view will already be stored in the transitionValues structure when this method is called. |
Animator onAppear (ViewGroup sceneRoot, View view, TransitionValues startValues, TransitionValues endValues)
此方法的默认实现将返回空Animator。 子类应该重写此方法以使目标显示所需的转换。 该方法只能从onAppear(ViewGroup, TransitionValues, int, TransitionValues, int) 。
| 参数(Parameters) | |
|---|---|
sceneRoot |
ViewGroup: The root of the transition hierarchy |
view |
View: The View to make appear. This will be in the target scene's View hierarchy and will be VISIBLE. |
startValues |
TransitionValues: The target values in the start scene |
endValues |
TransitionValues: The target values in the end scene |
| 返回(Returns) | |
|---|---|
Animator |
An Animator to be started at the appropriate time in the overall transition for this scene change. A null value means no animation should be run. |
Animator onDisappear (ViewGroup sceneRoot, View view, TransitionValues startValues, TransitionValues endValues)
此方法的默认实现将返回空Animator。 子类应该重写此方法,使目标消失与所需的转换。 该方法只能从onDisappear(ViewGroup, TransitionValues, int, TransitionValues, int) 。
| 参数(Parameters) | |
|---|---|
sceneRoot |
ViewGroup: The root of the transition hierarchy |
view |
View: The View to make disappear. This will be in the target scene's View hierarchy or in an ViewGroupOverlay and will be VISIBLE. |
startValues |
TransitionValues: The target values in the start scene |
endValues |
TransitionValues: The target values in the end scene |
| 返回(Returns) | |
|---|---|
Animator |
An Animator to be started at the appropriate time in the overall transition for this scene change. A null value means no animation should be run. |