Code example for ViewTreeObserver

Methods: addOnGlobalLayoutListener

0
 
		super.onStart(); 
 
		ViewTreeObserver vto = mExpandableList.getViewTreeObserver();
 
		vto.addOnGlobalLayoutListener(new OnGlobalLayoutListener(){
 
			@Override 
			public void onGlobalLayout(){ 
 
				if (getActivity() != null && mExpandableList != null)
					mExpandableList.setIndicatorBounds(mExpandableList.getRight()
					                                       - UIUtil.convertToDips(getActivity(), 
					                                                              40), 
					                                   mExpandableList.getWidth()
					                                       - UIUtil.convertToDips(getActivity(), 
					                                                              10)); 
			} 
		}); 
	}