I need to call requestLayout() in my custome view, but I noticed 
This should not be called while the view hierarchy is currently in a layout pass ({@link #
isInLayout()}.
So I deciede to use this code:
if(isInLayout()) {
    // request layout later
} else {
    requestLayout();
}
But the question is that I don't know how to request layout later, can I use addOnLayoutChangeListener ?
just like this:
addOnLayoutChangeListener(new OnLayoutChangeListener() {
    @Override
    public void onLayoutChange(View v, int left, int top, int right, int bottom, int oldLeft, int oldTop, int oldRight, int oldBottom) {
        requestLayout();
    }
});