S
S
Sergey Semenko2016-05-27 17:48:59
Java
Sergey Semenko, 2016-05-27 17:48:59

Why doesn't programmatically scroll to the specified RecyclerView element?

There is a button with a handler:

view.findViewById(R.id.main_button).setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View v) {
                winnerList.post(new Runnable() {
                    @Override
                    public void run() {
                        gameInfo.setVisibility(View.GONE);
                        winnerInfo.setVisibility(View.VISIBLE);
                        winnerList.smoothScrollToPosition(80);
                    }
                });
            }
        });

The idea is to hide the gameInfo (View), show the winnerInfo (View), inside which is the winnerList (RecyclerView), and scroll to the specified position (80), but smoothScrollToPosition only works after the second click. With what it can be connected?

Answer the question

In order to leave comments, you need to log in

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question