Code example for ViewTreeObserver

Methods: removeOnGlobalLayoutListener

0
					public void onGlobalLayout() { 
						onScrollChanged(); 
 
						ViewTreeObserver obs = mListView.getViewTreeObserver();
						if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.JELLY_BEAN) {
							obs.removeOnGlobalLayoutListener(this);
						} else { 
							obs.removeGlobalOnLayoutListener(this);
						} 
					} 
				}); 
 
		mListView.setOnScrollListener(new AbsListView.OnScrollListener() {
 
			@Override 
			public void onScrollStateChanged(AbsListView view, int scrollState) {
			} 
 
			@Override 
			public void onScroll(AbsListView view, int firstVisibleItem, int visibleItemCount, int totalItemCount) {
				onScrollChanged();