Android View 里面有用的函数

/**
 * Called when the window containing has change its visibility
 * (between {@link #GONE}, {@link #INVISIBLE}, and {@link #VISIBLE}).  Note
 * that this tells you whether or not your window is being made visible
 * to the window manager; this does not tell you whether or not
 * your window is obscured by other windows on the screen, even if it
 * is itself visible.
 *
 * @param visibility The new visibility of the window.
 */
protected void onWindowVisibilityChanged(@Visibility int visibility)
/**
 * Called when the visibility of the view or an ancestor of the view has
 * changed.
 *
 * @param changedView The view whose visibility changed. May be
 *                    {@code this} or an ancestor view.
 * @param visibility The new visibility, one of {@link #VISIBLE},
 *                   {@link #INVISIBLE} or {@link #GONE}.
 */
protected void onVisibilityChanged(@NonNull View changedView, @Visibility int visibility)
/**
 * Called when the user-visibility of this View is potentially affected by a change
 * to this view itself, an ancestor view or the window this view is attached to.
 *
 * @param isVisible true if this view and all of its ancestors are {@link #VISIBLE}
 *                  and this view's window is also visible
 */
@CallSuper
public void onVisibilityAggregated(boolean isVisible)

 

 

 

 

 

你可能感兴趣的:(自定义View)