How to change Toolbar while clicking along a Listview

Asked

Viewed 40 times

1

I’m a beginner in Android programming and would like to ask a question. I have a Listview that is connected to a Sqlite database. My question is: how could I make so that when the user took a long click on an item from that list a new Toolbar would appear?

For a better example, see the prints.

Toolbar muda quando um item tem um clique longo

1 answer

0

Try this:

final GestureDetector detetor = new GestureDetector(new GestureDetector.SimpleOnGestureListener() {
    public void onLongPress(MotionEvent e) {
        Log.e("", "Clique Longo Detetado");
        //Adicionas a tua ToolBar aqui
    }
});

public boolean onTouchEvent(MotionEvent event) {
    return detetor.onTouchEvent(event);
};

Browser other questions tagged

You are not signed in. Login or sign up in order to post.