I need to make a return button, like with a collapseActionView in the menu. Do you need to do it yourself for example through imageView or are there any built-in methods, for example from the backward support library?
1 answer
We show the button using getActionBar().setDisplayHomeAsUpEnabled(true) , or if you use the Lieb saver, then getSupportActionBar().setDisplayHomeAsUpEnabled(true); . Further to catch clicking on it we add the code:
@Override public boolean onOptionsItemSelected(MenuItem item) { switch (item.getItemId()) { case android.R.id.home: // тут пишем код обработки нажатия return true; } return super.onOptionsItemSelected(item); } |
collapseActionViewattribute is used to collapse / expand a widget likeSearchView, what return and where is your question? - pavlofff