“Android Back Press Ferolbar” Respostas de código

Botão Android Adicionar Voltar à barra de ferramentas

getSupportActionBar().setDisplayHomeAsUpEnabled(true);getSupportActionBar().setDisplayShowHomeEnabled(true);
Grotesque Goose

Android Back Press Ferolbar

@Override
public boolean onOptionsItemSelected(MenuItem item) {
switch (item.getItemId()) {
    case android.R.id.home:
        // this takes the user 'back', as if they pressed the left-facing    

      triangle icon on the main android toolbar.
        // if this doesn't work as desired, another possibility is to call   

        stopActivityTask();  // finish() here.
        getActivity().onBackPressed();
        return true;
    default:
        return super.onOptionsItemSelected(item);
}
}
Disgusted Dragonfly

Botão Android Adicionar Voltar à barra de ferramentas

Toolbar toolbar = (Toolbar) findViewById(R.id.toolbar);setSupportActionBar(toolbar);
Grotesque Goose

Respostas semelhantes a “Android Back Press Ferolbar”

Perguntas semelhantes a “Android Back Press Ferolbar”

Mais respostas relacionadas para “Android Back Press Ferolbar” em Java

Procure respostas de código populares por idioma

Procurar outros idiomas de código