放大活动过渡 - Android

时间:2016-02-09 07:18:58

标签: android animation

当我点击每个按钮时,我创建一个带有几个按钮的应用程序我想通过特定点击按钮框架放大动画来进行新活动。我使用<html lang="en" ng-app="myApp"> <body> <div ng-controller="directoryController"> <div ng-view> </div> </div> </body> <script src="angular.min.js"></script> <script src="https://ajax.googleapis.com/ajax/libs/angularjs/1.2.0rc1/angular-route.min.js"></script> <script> var app = angular.module("myApp", ['ngRoute']); app.config(function ($routeProvider) { $routeProvider .when('/', {templateUrl: 'directory.html'}) .when('/view/:id', {templateUrl: 'view.html', controller: 'viewController'}) .otherwise({redirectTo: '#'}) }); app.controller('directoryController', ['$scope', function ($scope) { //i have defined an array called data here suppose its there $scope.people = data; }]); app.controller('viewController', ['$scope', '$routeParams', function ($scope, $routeParams) { $scope.person = $scope.people[$routeParams.id] }]); </script> </html> 实现了这一点 现在我的问题是,它在所有设备上并不完美我认为是因为Pivot值如何从所有设备的按钮帧设置此动画。

我的zoom_in.xml

overridePendingTransition(R.anim.zoom_in, R.anim.zoom_out);

我的zoom_out.xml

<?xml version="1.0" encoding="utf-8"?>
<set xmlns:android="http://schemas.android.com/apk/res/android"  >
    <scale
    xmlns:android="http://schemas.android.com/apk/res/android"
    android:duration="@string/animation_duration"
    android:fromXScale="0.9999"
    android:fromYScale="0.15"
    android:pivotX="24%"
    android:pivotY="77.5%"
    android:toXScale="1"
    android:toYScale="1" >
    </scale>
 </set>

1 个答案:

答案 0 :(得分:1)

我找到了一个解决方案,它为我工作粘贴了 在按钮内的代码下方点击:

Intent i = new Intent(Currentactivity.this,  Nextactivity.class);

                      Bundle b = null;
                      if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.JELLY_BEAN) {
                          //b = ActivityOptions.makeScaleUpAnimation(view, 0, 0, view.getWidth(),
                          //                                         view.getHeight()).toBundle();
                          Bitmap bitmap = Bitmap.createBitmap(v.getWidth(), v.getHeight(), Bitmap.Config.ARGB_8888);
                          bitmap.eraseColor(Color.parseColor("#308cf8"));

                          b = ActivityOptions.makeThumbnailScaleUpAnimation(v, bitmap, 0, 0).toBundle();
                      }
                      startActivity(i, b);