android - 从 appwidget 制作缩放动画

标签 android animation android-activity android-appwidget appwidgetprovider

从小部件启动 Activity 时,一些应用程序小部件正在使用 makeScaleUpAnimation(在 JellyBean 4.1 中引入)。当您无法从您的小部件提供商那里访问 View 时,这怎么可能?

有什么方法可以获取整个 appwidgets View 之类的吗?我找不到解决方案..

ActivityOptions opts = ActivityOptions.makeScaleUpAnimation(view, 0, 0,
        view.getWidth(), view.getHeight());
  // Request the activity be started, using the custom animation options.
  startActivity(new Intent(MainActivity.this, AnimationActivity.class),
        opts.toBundle());

我正在从我的小部件打开短信收件箱

Intent inboxIntent = new Intent(Intent.ACTION_MAIN);
                inboxIntent.setType("vnd.android-dir/mms-sms");
                int flags = Intent.FLAG_ACTIVITY_NEW_TASK |

                        Intent.FLAG_ACTIVITY_SINGLE_TOP |          

                        Intent.FLAG_ACTIVITY_CLEAR_TOP;
                inboxIntent.setFlags(flags);

                context.startActivity(inboxIntent);

最佳答案

您的 Activity 应调用 getIntent().getSourceBounds() 来获取此信息。

关于android - 从 appwidget 制作缩放动画,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/17949634/

相关文章:

java - 为什么 Toast 会跳到此循环中的最后一个元素?

android - 如何将模块包含到项目中?

python - 圆内的动画线 - matplotlib

javascript - jQuery:同时设置元素位置和不透明度的动画

android - 未找到处理 Intent 的 Activity ?

android - Android 8.1 版不显示 OSM map 图 block

android - 从 WebView 加载一个 url 而不显示它

android 防止在 dialog.show 上显示键盘

android - 计时 fragment 转换 - Android

java - 调用 Activity 输入输出动画的最佳位置