@Override public void onScrollStateChanged(final AbsListView view, final int scrollState) { Log.i(TAG, "onScrollStateChanged: " + scrollState); if (scrollState == SCROLL_STATE_IDLE) { handler.removeCallbacks(showRunnable); handler.postDelayed(showRunnable, 100); } else if (scrollState == SCROLL_STATE_TOUCH_SCROLL) { handler.removeCallbacks(showRunnable); if (tooltipManager.active(100)) { tooltipManager.remove(100); } } }
@Override public void onScroll( final AbsListView view, final int firstVisibleItem, final int visibleItemCount, final int totalItemCount) { if (null != tooltipManager) { tooltipManager.update(100); } }
@Override public void run() { View child = listView.getChildAt(0); tooltipManager .create(MainActivity.this, 100) .maxWidth(450) .actionBarSize(Utils.getActionBarSize(getBaseContext())) .activateDelay(100) .anchor(new Point(512, 100), TooltipManager.Gravity.BOTTOM) .closePolicy(TooltipManager.ClosePolicy.None, 1500) .withCustomView(R.layout.custom_textview) .withStyleId(R.style.ToolTipLayoutCustomStyle) .text( "Test tooltip showing on a list, Test tooltip showing on a list, Test tooltip showing on a list...") .show(); }
@Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_main); List<String> array = new ArrayList<>(); for (int i = 0; i < 100; i++) { array.add(String.format("Item %d", i)); } listView = (ListView) findViewById(android.R.id.list); listView.setAdapter(new ArrayAdapter<>(this, android.R.layout.simple_list_item_1, array)); listView.setOnScrollListener(this); listView.setOnItemClickListener(this); tooltipManager = TooltipManager.getInstance(); }