简体   繁体   中英

android action bar home button method

I would like to close search view in action bar like home button closes it. Currently I am using intents, what method does action bar home button click does?

This is my way to cancel search or collapse it. Is there any smoother way?

case R.id.action_cancel:{
                Intent intent = new Intent(this, MainActivity.class);
                intent.addFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP);
                startActivity(intent);

我为“页脚”使用了片段和单独的布局,其中包含EditText和cancel按钮

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM