[library] Use layout() instead of onLayout() to fix lint error