从小部件启动 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/