Androids how to make a return button



  • I've got to do a return button, like when ActionView collapses in the menu. Do you have to do it yourself, for example, through the image of View or is there any built-in means, for example from the library of backup?



  • Show me the button with help. getActionBar().setDisplayHomeAsUpEnabled(true)or if liba saport is used, getSupportActionBar().setDisplayHomeAsUpEnabled(true);♪ Then we'll add the code to catch the press.

    @Override
    public boolean onOptionsItemSelected(MenuItem item) {
        switch (item.getItemId()) {
            case android.R.id.home:
                // тут пишем код обработки нажатия
                return true;
        }
        return super.onOptionsItemSelected(item);
    }
    



Suggested Topics

  • 2
  • 2
  • 2
  • 2
  • 2
  • 2
  • 2
  • 2
  • 2
  • 2
  • 2
  • 2
  • 2
  • 2
  • 2