java类android.view.animation.TranslateAnimation的实例源码

SubjectBookListActivity.java 文件源码 项目:GitHub 阅读 26 收藏 0 点赞 0 评论 0
private void hideTagGroup() {
    Animation mHiddenAction = new TranslateAnimation(Animation.RELATIVE_TO_SELF, 0.0f,
            Animation.RELATIVE_TO_SELF, 0.0f,
            Animation.RELATIVE_TO_SELF, 0.0f,
            Animation.RELATIVE_TO_SELF, -1.0f);
    mHiddenAction.setDuration(400);
    rsvTags.startAnimation(mHiddenAction);
    rsvTags.setVisibility(View.GONE);
}
UIIDialogImpl.java 文件源码 项目:RLibrary 阅读 36 收藏 0 点赞 0 评论 0
/**
 * 对话框启动时的动画
 */
@Override
public Animation loadStartAnimation() {
    TranslateAnimation translateAnimation = new TranslateAnimation(Animation.RELATIVE_TO_SELF, 0f, Animation.RELATIVE_TO_SELF, 0,
            Animation.RELATIVE_TO_SELF, 1f, Animation.RELATIVE_TO_SELF, 0f);
    AlphaAnimation alphaAnimation = new AlphaAnimation(0, 1);
    setDefaultConfig(translateAnimation, false);
    setDefaultConfig(alphaAnimation, false);

    AnimationSet animationSet = new AnimationSet(false);
    animationSet.addAnimation(alphaAnimation);
    animationSet.addAnimation(translateAnimation);
    return animationSet;
}
DownloadVideoAlbumPageActivity.java 文件源码 项目:letv 阅读 20 收藏 0 点赞 0 评论 0
private void showStreamPopWindowForView(View view) {
    this.animTopIn = new TranslateAnimation(1, 0.0f, 1, 0.0f, 1, -0.5f, 1, 0.0f);
    this.animTopIn.setDuration(300);
    this.layoutView.setAnimation(this.animTopIn);
    int[] arrayOfInf = new int[2];
    view.getLocationInWindow(arrayOfInf);
    int x = arrayOfInf[0];
    int y = arrayOfInf[1] + Util.dipToPx(45.0f);
    this.mPopupWindow.setAnimationStyle(R.style.popwin_anim_style);
    this.mPopupWindow.showAtLocation(view, 51, x, y);
}
SimpleAnimUtil.java 文件源码 项目:GitHub 阅读 27 收藏 0 点赞 0 评论 0
/**
 * 生成TranslateAnimation
 *
 * @param durationMillis 动画显示时间
 * @param start          初始位置
 */
public static Animation getTranslateAnimation(int start, int end, int durationMillis) {
    Animation translateAnimation = new TranslateAnimation(0, 0, start, end);
    translateAnimation.setDuration(durationMillis);
    translateAnimation.setFillEnabled(true);
    translateAnimation.setFillAfter(true);
    return translateAnimation;
}
AnimationUtil.java 文件源码 项目:PhotoPickApp 阅读 26 收藏 0 点赞 0 评论 0
public static void hideLine(Context context,View top,View bottom) {
    Animation topTranslateAnimation=new TranslateAnimation(0, 0, 0, -DensityUtil.dip2px(context,56f));
    topTranslateAnimation.setDuration(300);
    topTranslateAnimation.setInterpolator(context, android.R.anim.linear_interpolator);
    topTranslateAnimation.setFillAfter(true);
    top.startAnimation(topTranslateAnimation);

    Animation bottomTranslateAnimation=new TranslateAnimation(0, 0, 0, DensityUtil.dip2px(context,56f));
    bottomTranslateAnimation.setDuration(300);
    bottomTranslateAnimation.setInterpolator(context, android.R.anim.linear_interpolator);
    bottomTranslateAnimation.setFillAfter(true);
    bottom.startAnimation(bottomTranslateAnimation);
    top.setVisibility(View.GONE);
    bottom.setVisibility(View.GONE);
}
DCLoginFragment.java 文件源码 项目:aftercare-app-android 阅读 24 收藏 0 点赞 0 评论 0
@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstance) {
    View view = inflater.inflate(R.layout.fragment_login, container, false);

    ivLoginLogo = (ImageView) view.findViewById(R.id.iv_login_logo);

    Resources r = getResources();
    float translationPx = TypedValue.applyDimension(TypedValue.COMPLEX_UNIT_DIP, 100, r.getDisplayMetrics());

    AlphaAnimation logoAlphaAnimation = new AlphaAnimation(0, 1);
    logoAlphaAnimation.setDuration(500);

    TranslateAnimation logoTranslateAnimation = new TranslateAnimation(0, 0, translationPx, 0);
    logoTranslateAnimation.setDuration(500);

    AnimationSet logoAnimationSet = new AnimationSet(true);
    logoAnimationSet.addAnimation(logoAlphaAnimation);
    logoAnimationSet.addAnimation(logoTranslateAnimation);

    ivLoginLogo.startAnimation(logoAnimationSet);

    btnLoginFacebook = (DCButton) view.findViewById(R.id.btn_login_facebook);
    btnLoginFacebook.setOnClickListener(this);

    btnLoginGoogle = (DCButton) view.findViewById(R.id.btn_login_google);
    btnLoginGoogle.setOnClickListener(this);

    btnLoginTwitter = (DCButton) view.findViewById(R.id.btn_login_twitter);
    btnLoginTwitter.setOnClickListener(this);

    btnLogin = (DCButton) view.findViewById(R.id.btn_login_login);
    btnLogin.setOnClickListener(this);

    tilLoginEmail = (DCTextInputLayout) view.findViewById(R.id.til_login_email);
    tietLoginEmail = (DCTextInputEditText) view.findViewById(R.id.tiet_login_email);
    tietLoginEmail.setOnFocusChangeListener(this);

    tilLoginPassword = (DCTextInputLayout) view.findViewById(R.id.til_login_password);
    tietLoginPassword = (DCTextInputEditText) view.findViewById(R.id.tiet_login_password);

    tvLoginForgotPassword = (DCTextView) view.findViewById(R.id.tv_login_forgot_password);
    tvLoginForgotPassword.setOnClickListener(this);

    return view;
}
DCSentFeedbackFragment.java 文件源码 项目:aftercare-app-android 阅读 20 收藏 0 点赞 0 评论 0
@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstance) {
    View view = inflater.inflate(R.layout.fragment_sent_feedback, container, false);

    ivFeedbackTooth = (ImageView) view.findViewById(R.id.iv_feedback_tooth);
    tvFeedbackThankYou = (DCTextView) view.findViewById(R.id.tv_feedback_thank_you);
    tvFeedbackMessage = (DCTextView) view.findViewById(R.id.tv_feedback_message);


    Resources r = getResources();
    float translationPx = TypedValue.applyDimension(TypedValue.COMPLEX_UNIT_DIP, 100, r.getDisplayMetrics());

    AlphaAnimation logoAnimation = new AlphaAnimation(0, 1);
    logoAnimation.setDuration(2000);
    ivFeedbackTooth.startAnimation(logoAnimation);

    TranslateAnimation thankYouTranslate = new TranslateAnimation(0, 0, translationPx, 0);
    thankYouTranslate.setDuration(1000);
    AlphaAnimation thankYouAlpha = new AlphaAnimation(0, 1);
    thankYouAlpha.setDuration(1000);

    AnimationSet thankYouSet = new AnimationSet(true);
    thankYouSet.addAnimation(thankYouTranslate);
    thankYouSet.addAnimation(thankYouAlpha);
    tvFeedbackThankYou.startAnimation(thankYouSet);

    AlphaAnimation messageAnimation = new AlphaAnimation(0, 1);
    messageAnimation.setDuration(3500);
    tvFeedbackMessage.startAnimation(messageAnimation);

    runnable = new Runnable() {
        @Override
        public void run() {
            if (getActivity() != null) {
                if (listener != null)
                    listener.onFragmentRemoved();

                getActivity().getFragmentManager().beginTransaction().remove(DCSentFeedbackFragment.this).commitAllowingStateLoss();
            }
        }
    };

    handler.postDelayed(runnable, 5000);

    return view;
}
SubjectBookListActivity.java 文件源码 项目:BookReader-master 阅读 33 收藏 0 点赞 0 评论 0
private void hideTagGroup() {
    Animation mHiddenAction = new TranslateAnimation(Animation.RELATIVE_TO_SELF, 0.0f,
            Animation.RELATIVE_TO_SELF, 0.0f,
            Animation.RELATIVE_TO_SELF, 0.0f,
            Animation.RELATIVE_TO_SELF, -1.0f);
    mHiddenAction.setDuration(400);
    rsvTags.startAnimation(mHiddenAction);
    rsvTags.setVisibility(View.GONE);
}
AnimationUtil.java 文件源码 项目:appinventor-extensions 阅读 36 收藏 0 点赞 0 评论 0
private static void ApplyHorizontalScrollAnimation(View view, boolean left, int speed) {
  float sign = left ? 1f : -1f;
  AnimationSet animationSet = new AnimationSet(true);
  animationSet.setRepeatCount(Animation.INFINITE);
  animationSet.setRepeatMode(Animation.RESTART);

  TranslateAnimation move = new TranslateAnimation(Animation.RELATIVE_TO_PARENT, sign * 0.70f,
      Animation.RELATIVE_TO_PARENT, sign * -0.70f, Animation.RELATIVE_TO_PARENT, 0,
      Animation.RELATIVE_TO_PARENT, 0);
  move.setStartOffset(0);
  move.setDuration(speed);
  move.setFillAfter(true);
  animationSet.addAnimation(move);
  view.startAnimation(animationSet);
}
TagAnimationUtil.java 文件源码 项目:AmenEye 阅读 21 收藏 0 点赞 0 评论 0
/**
 * 从控件开始的位置移动到空间顶部
 */
public static TranslateAnimation moveToViewTop() {
    TranslateAnimation mHiddenAction = new TranslateAnimation(Animation.RELATIVE_TO_SELF, 0.0f,
            Animation.RELATIVE_TO_SELF, 0.0f, Animation.RELATIVE_TO_SELF,
            0.0f, Animation.RELATIVE_TO_SELF, -1.0f);
    mHiddenAction.setDuration(500);
    return mHiddenAction;
}


问题


面经


文章

微信
公众号

扫码关注公众号