public class ActivityOptionsCompat
extends Object
java.lang.Object | |
↳ | android.support.v4.app.ActivityOptionsCompat |
助手以向后兼容的方式访问API级别16中引入的 ActivityOptions
中的功能。
Protected constructors |
|
---|---|
ActivityOptionsCompat() |
Public methods |
|
---|---|
static ActivityOptionsCompat |
makeCustomAnimation(Context context, int enterResId, int exitResId) 创建一个ActivityOptions,指定在显示活动时运行的自定义动画。 |
static ActivityOptionsCompat |
makeScaleUpAnimation(View source, int startX, int startY, int startWidth, int startHeight) 创建一个ActivityOptions,指定一个动画,其中新活动从屏幕的一个小起始区域缩放至其最终完整表示。 |
static ActivityOptionsCompat |
makeSceneTransitionAnimation(Activity activity, View sharedElement, String sharedElementName) 使用交叉活动场景动画创建一个ActivityOptions以在活动之间转换。 |
static ActivityOptionsCompat |
makeSceneTransitionAnimation(Activity activity, Pair...<View, String> sharedElements) 使用交叉活动场景动画创建一个ActivityOptions以在活动之间转换。 |
static ActivityOptionsCompat |
makeThumbnailScaleUpAnimation(View source, Bitmap thumbnail, int startX, int startY) 创建一个ActivityOptions,指定将缩略图从给定位置缩放到正在启动的新活动窗口的动画。 |
Bundle |
toBundle() 将创建的选项作为Bundle返回,可以将其传递给 |
void |
update(ActivityOptionsCompat otherOptions) 从其他选项中提供的ActivityOptions中更新当前值。 |
Inherited methods |
|
---|---|
From class java.lang.Object
|
ActivityOptionsCompat ()
ActivityOptionsCompat makeCustomAnimation (Context context, int enterResId, int exitResId)
创建一个ActivityOptions,指定在显示活动时运行的自定义动画。
Parameters | |
---|---|
context |
Context : Who is defining this. This is the application that the animation resources will be loaded from. |
enterResId |
int : A resource ID of the animation resource to use for the incoming activity. Use 0 for no animation. |
exitResId |
int : A resource ID of the animation resource to use for the outgoing activity. Use 0 for no animation. |
Returns | |
---|---|
ActivityOptionsCompat |
Returns a new ActivityOptions object that you can use to supply these options as the options Bundle when starting an activity. |
ActivityOptionsCompat makeScaleUpAnimation (View source, int startX, int startY, int startWidth, int startHeight)
创建一个ActivityOptions,指定一个动画,其中新活动从屏幕的一个小起始区域缩放至其最终完整表示。
If the Intent this is being used with has not set itssetSourceBounds(android.graphics.Rect)
, those bounds will be filled in for you based on the initial bounds passed in here.
Parameters | |
---|---|
source |
View : The View that the new activity is animating from. This defines the coordinate space for startX and startY. |
startX |
int : The x starting location of the new activity, relative to source. |
startY |
int : The y starting location of the activity, relative to source. |
startWidth |
int : The initial width of the new activity. |
startHeight |
int : The initial height of the new activity. |
Returns | |
---|---|
ActivityOptionsCompat |
Returns a new ActivityOptions object that you can use to supply these options as the options Bundle when starting an activity. |
ActivityOptionsCompat makeSceneTransitionAnimation (Activity activity, View sharedElement, String sharedElementName)
使用交叉活动场景动画创建一个ActivityOptions以在活动之间转换。 该方法将一个共享元素的位置带到启动的Activity中。 sharedElement
的位置将被用作退出过渡的中心。 共享元素在启动的Activity中的位置将成为其进入Transition的中心。
这要求在调用Activity上启用FEATURE_CONTENT_TRANSITIONS
以导致退出转换。 被调用的活动中必须有相同的输入转换。
Parameters | |
---|---|
activity |
Activity : The Activity whose window contains the shared elements. |
sharedElement |
View : The View to transition to the started Activity. sharedElement must have a non-null sharedElementName. |
sharedElementName |
String : The shared element name as used in the target Activity. This may be null if it has the same name as sharedElement. |
Returns | |
---|---|
ActivityOptionsCompat |
Returns a new ActivityOptions object that you can use to supply these options as the options Bundle when starting an activity. |
ActivityOptionsCompat makeSceneTransitionAnimation (Activity activity, Pair...<View, String> sharedElements)
使用交叉活动场景动画创建一个ActivityOptions以在活动之间转换。 该方法将多个共享元素的位置传递给启动的Activity。 sharedElements中第一个元素的位置将用作退出过渡的中心。 相关共享元素在启动的Activity中的位置将成为其进入Transition的中心。
这要求在调用Activity上启用FEATURE_CONTENT_TRANSITIONS
以导致退出转换。 被调用的活动中必须有相同的输入转换。
Parameters | |
---|---|
activity |
Activity : The Activity whose window contains the shared elements. |
sharedElements |
Pair : The names of the shared elements to transfer to the called Activity and their associated Views. The Views must each have a unique shared element name. |
Returns | |
---|---|
ActivityOptionsCompat |
Returns a new ActivityOptions object that you can use to supply these options as the options Bundle when starting an activity. |
ActivityOptionsCompat makeThumbnailScaleUpAnimation (View source, Bitmap thumbnail, int startX, int startY)
创建一个ActivityOptions,指定将缩略图从给定位置缩放到正在启动的新活动窗口的动画。
If the Intent this is being used with has not set itssetSourceBounds(android.graphics.Rect)
, those bounds will be filled in for you based on the initial thumbnail location and size provided here.
Parameters | |
---|---|
source |
View : The View that this thumbnail is animating from. This defines the coordinate space for startX and startY. |
thumbnail |
Bitmap : The bitmap that will be shown as the initial thumbnail of the animation. |
startX |
int : The x starting location of the bitmap, relative to source. |
startY |
int : The y starting location of the bitmap, relative to source. |
Returns | |
---|---|
ActivityOptionsCompat |
Returns a new ActivityOptions object that you can use to supply these options as the options Bundle when starting an activity. |
Bundle toBundle ()
将创建的选项作为捆绑包返回,可以将其传递给startActivity(android.app.Activity, android.content.Intent, android.os.Bundle)
。 请注意,返回的Bundle仍属于ActivityOptions对象; 您不得修改它,但可以将其提供给采用选项Bundle的startActivity方法。
Returns | |
---|---|
Bundle |
void update (ActivityOptionsCompat otherOptions)
从其他选项中提供的ActivityOptions中更新当前值。 其他选项中定义的任何值都将替换基本选项中的值。
Parameters | |
---|---|
otherOptions |
ActivityOptionsCompat
|