【问题标题】:How to move a VideoView in a diagonal way from bottom left to top right of the screen如何以对角线方式将 VideoView 从屏幕的左下角移动到屏幕的右上角
【发布时间】:2017-04-28 10:48:14
【问题描述】:

我想在播放时移动视频视​​图而不触摸(*无需拖动,无需用户参与),移动应该是从右上角到屏幕左下角的对角线路径。我尝试了不同的动画,但我无法实现这一点,尝试了以下代码。

mVideoView = (VideoView) findViewById(R.id.videoview2);

animateVideoView(mVideoView);

private void animateVideoView(View v){

DisplayMetrics displayMetrics = new DisplayMetrics();
    getWindowManager().getDefaultDisplay().getMetrics(displayMetrics);
    final int height = displayMetrics.heightPixels;
    final int width = displayMetrics.widthPixels;

ObjectAnimator y = ObjectAnimator.ofFloat(v,
                "translationY", width, 100);

        ObjectAnimator x = ObjectAnimator.ofFloat(v,
                "translationX",100,height);

        animSetXY.playTogether(x, y);
        animSetXY.setInterpolator(new LinearInterpolator());
        animSetXY.setDuration(5000);
        animSetXY.start();
        v.startAnimation(animSetXY);



}

任何帮助将不胜感激...

【问题讨论】:

    标签: android android-animation android-videoview


    【解决方案1】:

    看看这个库,它可能对https://github.com/pedrovgs/DraggablePanel有帮助

    【讨论】:

      猜你喜欢
      • 2013-05-20
      • 2017-02-01
      • 2012-04-02
      • 2015-12-09
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2012-12-21
      • 2012-09-02
      相关资源
      最近更新 更多