当前位置: 首页>>代码示例>>Java>>正文


Java LayoutTransition.setAnimator方法代码示例

本文整理汇总了Java中android.animation.LayoutTransition.setAnimator方法的典型用法代码示例。如果您正苦于以下问题:Java LayoutTransition.setAnimator方法的具体用法?Java LayoutTransition.setAnimator怎么用?Java LayoutTransition.setAnimator使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在android.animation.LayoutTransition的用法示例。


在下文中一共展示了LayoutTransition.setAnimator方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: onCreate

import android.animation.LayoutTransition; //导入方法依赖的package包/类
@Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.activity_custom_layout_animations);


    LayoutTransition layoutTransition = new LayoutTransition();

    ObjectAnimator appearingAnim = ObjectAnimator.ofFloat(null, "rotationY", 0f, 90f, 180f, 270f, 359.9999f);
    appearingAnim.addListener(new AnimatorListenerAdapter() {
        public void onAnimationEnd(Animator anim) {
            View view = (View) ((ObjectAnimator) anim).getTarget();
            view.setRotationY(0f);
        }
    });

    layoutTransition.setAnimator(LayoutTransition.APPEARING, appearingAnim);
    layoutTransition.setDuration(LayoutTransition.APPEARING, 2000L);
    layoutTransition.setStartDelay(LayoutTransition.APPEARING, 0);

    gridContainer.setLayoutTransition(layoutTransition);
}
 
开发者ID:zawadz88,项目名称:AnimationShowcase,代码行数:23,代码来源:CustomLayoutAnimationsActivity.java

示例2: setGiftLayout

import android.animation.LayoutTransition; //导入方法依赖的package包/类
/**
 * @param giftLayoutParent 存放礼物控件的父容器
 * @param giftLayoutNums   礼物控件的数量
 * @return
 */
public GiftControl setGiftLayout(LinearLayout giftLayoutParent, @NonNull int giftLayoutNums) {
    if (giftLayoutNums <= 0) {
        throw new IllegalArgumentException("GiftFrameLayout数量必须大于0");
    }
    if (giftLayoutParent.getChildCount() > 0) {//如果父容器没有子孩子,就进行添加
        return this;
    }
    mGiftLayoutParent = giftLayoutParent;
    mGiftLayoutMaxNums = giftLayoutNums;
    LayoutTransition transition = new LayoutTransition();
    transition.setAnimator(LayoutTransition.CHANGE_APPEARING,
            transition.getAnimator(LayoutTransition.CHANGE_APPEARING));
    transition.setAnimator(LayoutTransition.APPEARING,
            transition.getAnimator(LayoutTransition.APPEARING));
    transition.setAnimator(LayoutTransition.DISAPPEARING,
            transition.getAnimator(LayoutTransition.CHANGE_APPEARING));
    transition.setAnimator(LayoutTransition.CHANGE_DISAPPEARING,
            transition.getAnimator(LayoutTransition.DISAPPEARING));
    mGiftLayoutParent.setLayoutTransition(transition);

    return this;
}
 
开发者ID:DyncKathline,项目名称:LiveGiftLayout,代码行数:28,代码来源:GiftControl.java

示例3: setupTransition

import android.animation.LayoutTransition; //导入方法依赖的package包/类
private void setupTransition(LayoutTransition transition) {
    CheckBox customAnimCB = (CheckBox) findViewById(R.id.customAnimCB);
    CheckBox appearingCB = (CheckBox) findViewById(R.id.appearingCB);
    CheckBox disappearingCB = (CheckBox) findViewById(R.id.disappearingCB);
    CheckBox changingAppearingCB = (CheckBox) findViewById(R.id.changingAppearingCB);
    CheckBox changingDisappearingCB = (CheckBox) findViewById(R.id.changingDisappearingCB);
    transition.setAnimator(LayoutTransition.APPEARING, appearingCB.isChecked() ?
            (customAnimCB.isChecked() ? customAppearingAnim : defaultAppearingAnim) : null);
    transition.setAnimator(LayoutTransition.DISAPPEARING, disappearingCB.isChecked() ?
            (customAnimCB.isChecked() ? customDisappearingAnim : defaultDisappearingAnim) : null);
    transition.setAnimator(LayoutTransition.CHANGE_APPEARING, changingAppearingCB.isChecked() ?
            (customAnimCB.isChecked() ? customChangingAppearingAnim :
                    defaultChangingAppearingAnim) : null);
    transition.setAnimator(LayoutTransition.CHANGE_DISAPPEARING,
            changingDisappearingCB.isChecked() ?
                    (customAnimCB.isChecked() ? customChangingDisappearingAnim :
                            defaultChangingDisappearingAnim) : null);
}
 
开发者ID:REBOOTERS,项目名称:AndroidAnimationExercise,代码行数:19,代码来源:LayoutAnimationsActivity.java

示例4: a

import android.animation.LayoutTransition; //导入方法依赖的package包/类
private static LayoutTransition a()
{
    LayoutTransition layouttransition = new LayoutTransition();
    layouttransition.setDuration(90L);
    layouttransition.setInterpolator(2, new AccelerateDecelerateInterpolator());
    layouttransition.setInterpolator(3, new AccelerateDecelerateInterpolator());
    ObjectAnimator objectanimator = ObjectAnimator.ofFloat(null, "rotationX", new float[] {
        90F, 0.0F
    }).setDuration(layouttransition.getDuration(2));
    layouttransition.setAnimator(2, objectanimator);
    objectanimator.addListener(new d());
    ObjectAnimator objectanimator1 = ObjectAnimator.ofFloat(null, "rotationX", new float[] {
        0.0F, -90F
    }).setDuration(layouttransition.getDuration(3));
    layouttransition.setAnimator(3, objectanimator1);
    objectanimator1.addListener(new e());
    return layouttransition;
}
 
开发者ID:vishnudevk,项目名称:MiBandDecompiled,代码行数:19,代码来源:AnimUtil.java

示例5: setupTransition

import android.animation.LayoutTransition; //导入方法依赖的package包/类
private void setupTransition(LayoutTransition transition) {
    CheckBox customAnimCB = (CheckBox) findViewById(R.id.customAnimCB);
    CheckBox appearingCB = (CheckBox) findViewById(R.id.appearingCB);
    CheckBox disappearingCB = (CheckBox) findViewById(R.id.disappearingCB);
    CheckBox changingAppearingCB = (CheckBox) findViewById(R.id.changingAppearingCB);
    CheckBox changingDisappearingCB = (CheckBox) findViewById(R.id.changingDisappearingCB);
    transition.setAnimator(LayoutTransition.APPEARING, appearingCB.isChecked() ?
            (customAnimCB.isChecked() ? customAppearingAnim : defaultAppearingAnim) : null);
    transition.setAnimator(LayoutTransition.DISAPPEARING, disappearingCB.isChecked() ?
            (customAnimCB.isChecked() ? customDisappearingAnim : defaultDisappearingAnim) : null);
    transition.setAnimator(LayoutTransition.CHANGE_APPEARING, changingAppearingCB.isChecked() ?
            (customAnimCB.isChecked() ? customChangingAppearingAnim :
                    defaultChangingAppearingAnim) : null);
    transition.setAnimator(LayoutTransition.CHANGE_DISAPPEARING,
            changingDisappearingCB.isChecked() ?
            (customAnimCB.isChecked() ? customChangingDisappearingAnim :
                    defaultChangingDisappearingAnim) : null);
}
 
开发者ID:luoqii,项目名称:ApkLauncher,代码行数:19,代码来源:LayoutAnimations.java

示例6: setCardStreamAnimator

import android.animation.LayoutTransition; //导入方法依赖的package包/类
@TargetApi(Build.VERSION_CODES.HONEYCOMB)
public void setCardStreamAnimator( CardStreamAnimator animators ){

    if( animators == null )
        mAnimators = new CardStreamAnimator.EmptyAnimator();
    else
        mAnimators = animators;

    LayoutTransition layoutTransition = getLayoutTransition();

    if( layoutTransition != null ){
        layoutTransition.setAnimator( LayoutTransition.APPEARING,
                mAnimators.getAppearingAnimator(getContext()) );
        layoutTransition.setAnimator( LayoutTransition.DISAPPEARING,
                mAnimators.getDisappearingAnimator(getContext()) );
    }
}
 
开发者ID:googlesamples,项目名称:android-play-places,代码行数:18,代码来源:CardStreamLinearLayout.java

示例7: getDefaultTransition

import android.animation.LayoutTransition; //导入方法依赖的package包/类
public static LayoutTransition getDefaultTransition() {
    LayoutTransition itemLayoutTransition = new LayoutTransition();
    itemLayoutTransition.setStartDelay(LayoutTransition.APPEARING, 0);
    itemLayoutTransition.setStartDelay(LayoutTransition.DISAPPEARING, 0);
    itemLayoutTransition.setStartDelay(LayoutTransition.CHANGE_APPEARING, 0);
    itemLayoutTransition.setStartDelay(LayoutTransition.CHANGE_DISAPPEARING, 0);
    itemLayoutTransition.setStartDelay(LayoutTransition.CHANGING, 0);
    itemLayoutTransition.setDuration(100);
    itemLayoutTransition.setInterpolator(LayoutTransition.CHANGING, new OvershootInterpolator(2f));
    Animator scaleUp = ObjectAnimator.ofPropertyValuesHolder((Object) null, PropertyValuesHolder.ofFloat(View.SCALE_X, 1, 1), PropertyValuesHolder.ofFloat(View.SCALE_Y, 0, 1));
    scaleUp.setDuration(50);
    scaleUp.setStartDelay(50);
    Animator scaleDown = ObjectAnimator.ofPropertyValuesHolder((Object) null, PropertyValuesHolder.ofFloat(View.SCALE_X, 1, 1), PropertyValuesHolder.ofFloat(View.SCALE_Y, 1, 0));
    scaleDown.setDuration(2);
    itemLayoutTransition.setAnimator(LayoutTransition.APPEARING, scaleUp);
    itemLayoutTransition.setAnimator(LayoutTransition.DISAPPEARING, null);
    itemLayoutTransition.enableTransitionType(LayoutTransition.CHANGING);
    return itemLayoutTransition;
}
 
开发者ID:breadwallet,项目名称:breadwallet-android,代码行数:20,代码来源:BRAnimator.java

示例8: initView

import android.animation.LayoutTransition; //导入方法依赖的package包/类
private void initView() {
    list = new ArrayList<>();
    layoutTransitionAdapter = new LayoutTransitionAdapter();
    listView.setAdapter(layoutTransitionAdapter);

    layoutTransition = new LayoutTransition();
    layoutTransition.setAnimator(LayoutTransition.APPEARING,
            (ObjectAnimator.ofFloat(this, "translationY", -500, 0).setDuration(1000)));
    listView.setLayoutTransition(layoutTransition);
}
 
开发者ID:alidili,项目名称:TestDemo,代码行数:11,代码来源:LayoutTransitionActivity.java

示例9: initSpringboardView

import android.animation.LayoutTransition; //导入方法依赖的package包/类
private void initSpringboardView(Context context, AttributeSet attrs, int defStyleAttr, int defStyleRes)
{
    final TypedArray a = context.obtainStyledAttributes(
            attrs, R.styleable.Springboard, defStyleAttr, defStyleRes);
    deleteIcon = a.getDrawable(R.styleable.Springboard_delete_icon);
    rowCount = a.getInt(R.styleable.Springboard_row_count, 3);
    colCount = a.getInt(R.styleable.Springboard_column_count, 3);
    defaultFolderName = a.getString(R.styleable.Springboard_default_folder_name);
    dividerWidth = a.getDimensionPixelOffset(R.styleable.Springboard_divider_width, 0);
    dividerColor = a.getColor(R.styleable.Springboard_divider_color, 0);
    isLastItemStable = a.getBoolean(R.styleable.Springboard_is_last_item_stable, false);
    stableHeaderCount = a.getInt(R.styleable.Springboard_stable_header_count, 0);
    page_divider_width = a.getDimensionPixelOffset(R.styleable.Springboard_page_divider_width, 0);

    if (dividerWidth != 0 && dividerColor != 0)
    {
        setWillNotDraw(false);
    }
    a.recycle();
    setFocusable(true);
    setFocusableInTouchMode(true);
    this.mScroller = new Scroller(getContext());
    FingerFlowViewManager.getInstance().init(getContext());
    setOverScrollMode(OVER_SCROLL_ALWAYS);
    final ViewConfiguration configuration = ViewConfiguration.get(getContext());
    mTouchSlop = configuration.getScaledTouchSlop();
    mMinimumVelocity = 700;
    mMaximumVelocity = configuration.getScaledMaximumFlingVelocity();
    mPaint = new Paint(Paint.ANTI_ALIAS_FLAG);
    mLayoutTransition = new LayoutTransition();
    mLayoutTransition.setAnimator(LayoutTransition.DISAPPEARING, null);
    mLayoutTransition.setAnimator(LayoutTransition.APPEARING, null);
    setLayoutTransition(mLayoutTransition);
}
 
开发者ID:xiaohepan,项目名称:springboardView,代码行数:35,代码来源:SpringboardView.java

示例10: initAppBarLayout

import android.animation.LayoutTransition; //导入方法依赖的package包/类
private void initAppBarLayout(){
    LayoutTransition mTransition = new LayoutTransition();
    /**
     * 添加View时过渡动画效果
     */
    ObjectAnimator addAnimator = ObjectAnimator.ofFloat(null, "translationY", 0, 1.f).
            setDuration(mTransition.getDuration(LayoutTransition.APPEARING));
    mTransition.setAnimator(LayoutTransition.APPEARING, addAnimator);

    //header layout height
    final int headerHeight = getResources().getDimensionPixelOffset(R.dimen.header_height);
    mAppBarLayout = (AppBarLayout) findViewById(R.id.appbar);
    mAppBarLayout.setLayoutTransition(mTransition);

    mAppBarLayout.addOnOffsetChangedListener(new AppBarLayout.OnOffsetChangedListener() {
        @Override
        public void onOffsetChanged(AppBarLayout appBarLayout, int verticalOffset) {
            verticalOffset = Math.abs(verticalOffset);
            if ( verticalOffset >= headerHeight ){
                isHideHeaderLayout = true;
                //当偏移量超过顶部layout的高度时,我们认为他已经完全移动出屏幕了
                new Handler().postDelayed(new Runnable() {
                    @Override
                    public void run() {
                        AppBarLayout.LayoutParams mParams = (AppBarLayout.LayoutParams) headerLayout.getLayoutParams();
                        mParams.setScrollFlags(0);
                        headerLayout.setLayoutParams(mParams);
                        headerLayout.setVisibility(View.GONE);
                    }
                },100);
            }
        }
    });
}
 
开发者ID:felix1022224,项目名称:adjustablelayout,代码行数:35,代码来源:MainActivity.java

示例11: setupInAnimations

import android.animation.LayoutTransition; //导入方法依赖的package包/类
private void setupInAnimations() {
    mPushInAnimator = (ObjectAnimator) AnimatorInflater.loadAnimator(this, R.animator.slide_in_right);
    mPushOutAnimator = (ObjectAnimator) AnimatorInflater.loadAnimator(this, R.animator.fade_out);
    mPopInAnimator = (ObjectAnimator) AnimatorInflater.loadAnimator(this, R.animator.fade_in);
    ObjectAnimator popOutAnimator = (ObjectAnimator) AnimatorInflater.loadAnimator(this, R.animator.slide_out_right);

    mPushOutAnimator.setStartDelay(100);

    mPopOutTransition = new LayoutTransition();
    mPopOutTransition.setAnimator(LayoutTransition.DISAPPEARING, popOutAnimator);
    mPopOutTransition.setDuration(popOutAnimator.getDuration());
}
 
开发者ID:ShaolinZhang,项目名称:HACKxFDU-CrisisProbingUAV,代码行数:13,代码来源:MainActivity.java

示例12: initLayoutChangeAnimation

import android.animation.LayoutTransition; //导入方法依赖的package包/类
private void initLayoutChangeAnimation() {
    final Animator showAnimation = ObjectAnimator.ofPropertyValuesHolder(PropertyValuesHolder.ofFloat("scaleX", 1, 0));
    final Animator hideAnimation = ObjectAnimator.ofPropertyValuesHolder(PropertyValuesHolder.ofFloat("scaleX", 0, 1));
    final LayoutTransition layoutTransition = new LayoutTransition();
    layoutTransition.setDuration(50);
    layoutTransition.setStartDelay(LayoutTransition.CHANGE_APPEARING, 0);
    layoutTransition.setStartDelay(LayoutTransition.CHANGE_DISAPPEARING, 0);
    layoutTransition.setAnimator(LayoutTransition.APPEARING, hideAnimation);
    layoutTransition.setAnimator(LayoutTransition.DISAPPEARING, showAnimation);
    setLayoutTransition(layoutTransition);
}
 
开发者ID:toshiapp,项目名称:toshi-android-client,代码行数:12,代码来源:ChatInputView.java

示例13: setupAnimations

import android.animation.LayoutTransition; //导入方法依赖的package包/类
private void setupAnimations(LayoutTransition transition) {

		ObjectAnimator animIn = ObjectAnimator.ofFloat(null, "translationY", SmileyPickerUtility.getScreenHeight(this.activity), mPickerHeight).setDuration(
				transition.getDuration(LayoutTransition.APPEARING));
		transition.setAnimator(LayoutTransition.APPEARING, animIn);

		ObjectAnimator animOut = ObjectAnimator.ofFloat(null, "translationY", mPickerHeight, SmileyPickerUtility.getScreenHeight(this.activity)).setDuration(
				transition.getDuration(LayoutTransition.DISAPPEARING));
		transition.setAnimator(LayoutTransition.DISAPPEARING, animOut);

	}
 
开发者ID:lookwhatlook,项目名称:WeiboWeiBaTong,代码行数:12,代码来源:SmileyPicker.java

示例14: onCreate

import android.animation.LayoutTransition; //导入方法依赖的package包/类
@Override
public void onCreate(Bundle savedInstanceState)
{
	super.onCreate(savedInstanceState);
	setContentView(R.layout.layout_animator);
	viewGroup = (ViewGroup) findViewById(R.id.id_container);
	mAppear = (CheckBox) findViewById(R.id.id_appear);
	mChangeAppear = (CheckBox) findViewById(R.id.id_change_appear);
	mDisAppear = (CheckBox) findViewById(R.id.id_disappear);
	mChangeDisAppear = (CheckBox) findViewById(R.id.id_change_disappear);

	mAppear.setOnCheckedChangeListener(this);
	mChangeAppear.setOnCheckedChangeListener(this);
	mDisAppear.setOnCheckedChangeListener(this);
	mChangeDisAppear.setOnCheckedChangeListener(this);

	// 创建一个GridLayout
	mGridLayout = new GridLayout(this);
	// 设置每列5个按钮
	mGridLayout.setColumnCount(5);
	// 添加到布局中
	viewGroup.addView(mGridLayout);
	// 默认动画全部开启
	mTransition = new LayoutTransition();
	mTransition.setAnimator(LayoutTransition.APPEARING, (mAppear
			.isChecked() ? ObjectAnimator.ofFloat(this, "scaleX", 0, 1)
			: null));
	mGridLayout.setLayoutTransition(mTransition);

}
 
开发者ID:cxbiao,项目名称:Android_Study_Demos,代码行数:31,代码来源:LayoutAnimaActivity.java

示例15: onCheckedChanged

import android.animation.LayoutTransition; //导入方法依赖的package包/类
/**
	 * 过渡的类型一共有四种:

	LayoutTransition.APPEARING 当一个View在ViewGroup中出现时,对此View设置的动画
	
	LayoutTransition.CHANGE_APPEARING 当一个View在ViewGroup中出现时,对此View对其他View位置造成影响,对其他View设置的动画
	
	LayoutTransition.DISAPPEARING  当一个View在ViewGroup中消失时,对此View设置的动画
	
	LayoutTransition.CHANGE_DISAPPEARING 当一个View在ViewGroup中消失时,对此View对其他View位置造成影响,对其他View设置的动画
	
	LayoutTransition.CHANGE 不是由于View出现或消失造成对其他View位置造成影响,然后对其他View设置的动画。
	
	注意动画到底设置在谁身上,此View还是其他View。
	 */
	@Override
	public void onCheckedChanged(CompoundButton buttonView, boolean isChecked)
	{
		mTransition = new LayoutTransition();
		mTransition.setAnimator(LayoutTransition.APPEARING,(mAppear.isChecked()?
				mTransition.getAnimator(LayoutTransition.APPEARING):null));
		//当然了动画支持自定义,还支持设置时间,比如我们修改下,添加的动画为:
//		mTransition.setAnimator(LayoutTransition.APPEARING, (mAppear
//				.isChecked() ? ObjectAnimator.ofFloat(this, "scaleX", 0, 1)  
//				: null));
		mTransition
				.setAnimator(
						LayoutTransition.CHANGE_APPEARING,
						(mChangeAppear.isChecked() ? mTransition
								.getAnimator(LayoutTransition.CHANGE_APPEARING)
								: null));
		mTransition.setAnimator(
				LayoutTransition.DISAPPEARING,
				(mDisAppear.isChecked() ? mTransition
						.getAnimator(LayoutTransition.DISAPPEARING) : null));
		mTransition.setAnimator(
				LayoutTransition.CHANGE_DISAPPEARING,
				(mChangeDisAppear.isChecked() ? mTransition
						.getAnimator(LayoutTransition.CHANGE_DISAPPEARING)
						: null));
		mGridLayout.setLayoutTransition(mTransition);
	}
 
开发者ID:cxbiao,项目名称:Android_Study_Demos,代码行数:43,代码来源:LayoutAnimaActivity.java


注:本文中的android.animation.LayoutTransition.setAnimator方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。