本文整理匯總了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);
}