You have a view similar to the playback view of a video player.
View alwaysAppearingView;
And you have a listView that you want to hide automatically after a delay.
ListView listView;
Let implements OnTouchListener for alwaysAppearingView;
alwaysAppearingView.setOnTouchListener(new View.OnTouchListener() { @Override public boolean onTouch(View view, MotionEvent motionEvent) { listView.setVisibility(View.VISIBLE); listView.postDelayed(new Runnable() { @Override public void run() { listView.setVisibility(View.GONE);
You check every touch, when you touch, you make the ListView visible and if you donβt have touches for 3000 milliseconds (3 seconds), the listView disappears. Give it a try.
source share