private static void FadeIn(View v) { if (v.Visibility != ViewStates.Visible) { Animation fadeIn = new AlphaAnimation(0, 1); fadeIn.Interpolator = new DecelerateInterpolator(); fadeIn.Duration = 300; fadeIn.SetAnimationListener(new FadeView(v, true)); v.StartAnimation(fadeIn); } v.Visibility = ViewStates.Visible; }
private void fadeOut(View v, bool delay = true) { long duration = 0; if (delay) { duration = 300; } if (v.Visibility != ViewStates.Gone) { Animation fadeOut = new AlphaAnimation(1, 0); fadeOut.Interpolator = new AccelerateInterpolator(); fadeOut.Duration = duration; fadeOut.SetAnimationListener(new FadeView(v)); v.StartAnimation(fadeOut); } }
private void InitView() { CardView card_share_view = FindViewById <CardView>(Resource.Id.card_share_view); RelativeLayout rela_round_big = FindViewById <RelativeLayout>(Resource.Id.rela_round_big); tv_share_view_tip = FindViewById <TextView>(Resource.Id.tv_share_view_tip); if (Intent != null) { int color = Intent.GetIntExtra("color", 0); if (color == 1) { rela_round_big.BackgroundTintList = Android.Content.Res.ColorStateList.ValueOf(new Android.Graphics.Color(Utils.AppUtils.GetColor(this, Resource.Color.google_blue))); } else if (color == 2) { rela_round_big.BackgroundTintList = Android.Content.Res.ColorStateList.ValueOf(new Android.Graphics.Color(Utils.AppUtils.GetColor(this, Resource.Color.google_green))); } else if (color == 3) { rela_round_big.BackgroundTintList = Android.Content.Res.ColorStateList.ValueOf(new Android.Graphics.Color(Utils.AppUtils.GetColor(this, Resource.Color.google_yellow))); } else if (color == 4) { rela_round_big.BackgroundTintList = Android.Content.Res.ColorStateList.ValueOf(new Android.Graphics.Color(Utils.AppUtils.GetColor(this, Resource.Color.google_red))); } else { rela_round_big.BackgroundTintList = Android.Content.Res.ColorStateList.ValueOf(new Android.Graphics.Color(Utils.AppUtils.GetColor(this, Resource.Color.gray))); } card_share_view.SetOnTouchListener(this); AlphaAnimation alphaAnimation = new AlphaAnimation(1.0f, 0.0f); alphaAnimation.Duration = 1500; alphaAnimation.StartOffset = 1000; alphaAnimation.SetAnimationListener(this); tv_share_view_tip.StartAnimation(alphaAnimation); } }