一些应用小部件在从小部件启动活动时使用了makeScaleUpAnimation(在JellyBean 4.1中引入)。当您无法从小部件提供程序访问视图时,如何实现这一点?
是否有办法获取整个应用小部件视图或类似的东西?我找不到解决方案。
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);
view.setLayoutParams(new LayoutParams(0,0)); ActivityOptions opts = ActivityOptions.makeScaleUpAnimation(view, intent.getSourceBounds().left, intent.getSourceBounds().top, intent.getSourceBounds().width(), intent.getSourceBounds().height()); context.startActivity(threadIntent, opts.toBundle());`
- Thoast83