本文整理汇总了Java中android.support.v4.app.ActivityOptionsCompat.makeCustomAnimation方法的典型用法代码示例。如果您正苦于以下问题:Java ActivityOptionsCompat.makeCustomAnimation方法的具体用法?Java ActivityOptionsCompat.makeCustomAnimation怎么用?Java ActivityOptionsCompat.makeCustomAnimation使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类android.support.v4.app.ActivityOptionsCompat
的用法示例。
在下文中一共展示了ActivityOptionsCompat.makeCustomAnimation方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: onOptionsItemSelected
import android.support.v4.app.ActivityOptionsCompat; //导入方法依赖的package包/类
@Override
public boolean onOptionsItemSelected(MenuItem item) {
switch (item.getItemId()) {
case R.id.action_about:
Intent i = new Intent(MainActivity.this, AboutActivity.class);
ActivityOptionsCompat options = ActivityOptionsCompat.makeCustomAnimation(MainActivity.this, android.R.anim.fade_in, android.R.anim.fade_out);
startActivity(i, options.toBundle());
return true;
default:
return true;
}
}
示例2: onItemClicked
import android.support.v4.app.ActivityOptionsCompat; //导入方法依赖的package包/类
@Override
public void onItemClicked(View view, SettingsCategoryAdapter.SettingsCategoryViewHolder settingsCategoryViewHolder) {
SettingsCategory category = settingsCategoryViewHolder.getData();
ActivityOptionsCompat settingsAnim = ActivityOptionsCompat.makeCustomAnimation(this, R.anim.slide_in_right_anim, R.anim.fade_out_semi_anim); // First animation is how the new activity enters - Second is how the current activity exits
ActivityCompat.startActivity(this, category.getIntent(), settingsAnim.toBundle());
}