本文整理汇总了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);
}
示例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;
}
示例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);
}
示例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;
}
示例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);
}
示例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()) );
}
}
示例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;
}
示例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);
}
示例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);
}
示例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);
}
}
});
}
示例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());
}
示例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);
}
示例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);
}
示例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);
}
示例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);
}