Android开发之显示截图动画效果直到消失
生活随笔
收集整理的這篇文章主要介紹了
Android开发之显示截图动画效果直到消失
小編覺得挺不錯的,現在分享給大家,幫大家做個參考.
public void showScreen(Uri uri, String path) {// 顯示當前截圖mLlSnapshot.setVisibility(View.VISIBLE);mIvSnapshot.setImageURI(uri == null ? Uri.parse(path) : uri);mIvSnapshot.setOnClickListener(v -> {// 打開截圖Intent intent = new Intent();intent.setAction(Intent.ACTION_VIEW);intent.addCategory(Intent.CATEGORY_DEFAULT);intent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK);intent.setDataAndType(uri == null ? Uri.fromFile(new File(path)) : uri, "image/*");context.startActivity(intent);});showPicAnim(mLlSnapshot);new Handler().postDelayed(new Runnable() {@Overridepublic void run() {mLlSnapshot.setVisibility(View.INVISIBLE);mIvSnapshot.setImageDrawable(null);mIvSnapshot.setOnClickListener(null); }}, 5000);}/*** 截圖動畫*/public void showPicAnim(View view) {ObjectAnimator alphaAnim = ObjectAnimator.ofFloat(view, "alpha", 0.0f, 1.0f);ObjectAnimator scaleXAnim = ObjectAnimator.ofFloat(view, "scaleX", 0.0f, 1.0f);ObjectAnimator scaleYAnim = ObjectAnimator.ofFloat(view, "scaleY", 0.0f, 1.0f);AnimatorSet set = new AnimatorSet();set.playTogether(alphaAnim, scaleXAnim, scaleYAnim);set.setDuration(500);set.start();}
總結
以上是生活随笔為你收集整理的Android开发之显示截图动画效果直到消失的全部內容,希望文章能夠幫你解決所遇到的問題。
- 上一篇: 凭证保存期限是多久
- 下一篇: 如何在macbook上安装windows