使用onOptionsItemSelected中的View参数启动一个类

时间:2018-04-16 16:12:06

标签: java android class view

我想用View参数启动一个类 我无法解释,但这是我的班级

public void presentActivity(View view)
{
    ActivityOptionsCompat activityOptionsCompat = ActivityOptionsCompat.makeSceneTransitionAnimation
            (this,view,"transition");

    int revealX = (int) (view.getX() + view.getWidth() / 2);
    int revealY = (int) (view.getY() + view.getHeight()/ 2);

    Intent search = new Intent(this,search_activity.class);
    search.putExtra(search_activity.EXTRA_CIRCULAR_REVEAL_X,revealX);
    search.putExtra(search_activity.EXTRA_CIRCULAR_REVEAL_Y, revealY);

    ActivityCompat.startActivity(this, search, activityOptionsCompat.toBundle());
}

我需要知道如何从

启动presentActivity
 public boolean onOptionsItemSelected(MenuItem menuItem)
{
    return super.onOptionsItemSelected(menuItem);
}
请帮助我,真的需要一种方法来做到这一点; 感谢。

0 个答案:

没有答案