GridView基于pulltorefresh实现下拉刷新 上拉加载更多功能,flutter文档

*/

public final T getRefreshableView() {

return refreshableView;

}

/**

  • Whether Pull-to-Refresh is enabled

  • @return enabled

*/

public final boolean isPullToRefreshEnabled() {

return isPullToRefreshEnabled;

}

/**

  • Returns whether the widget has disabled scrolling on the Refreshable View

  • while refreshing.

  • @return true if the widget has disabled scrolling while refreshing

*/

public final boolean isDisableScrollingWhileRefreshing() {

return disableScrollingWhileRefreshing;

}

/**

  • Returns whether the Widget is currently in the Refreshing state

  • @return true if the Widget is currently refreshing

*/

public final boolean isRefreshing() {

return state == REFRESHING || state == MANUAL_REFRESHING;

}

/**

  • By default the Widget disabled scrolling on the Refreshable View while

  • refreshing. This method can change this behaviour.

  • @param disableScrollingWhileRefreshing

  •        - true if you want to disable scrolling while refreshing
    

*/

public final void setDisableScrollingWhileRefreshing(

boolean disableScrollingWhileRefreshing) {

this.disableScrollingWhileRefreshing = disableScrollingWhileRefreshing;

}

/**

  • Mark the current Refresh as complete. Will Reset the UI and hide the

  • Refreshing View

*/

public final void onRefreshComplete() {

if (state != PULL_TO_REFRESH) {

resetHeader();

if (onShowLayoutListener != null) {

onShowLayoutListener.onDismiss();

}

}

}

/**

  • Set OnRefreshListener for the Widget

  • @param listener

  •        - Listener to be used when the Widget is set to Refresh
    

*/

public final void setOnRefreshListener(OnRefreshListener listener) {

onRefreshListener = listener;

}

/**

  • auto load headerLayout to refresh

  • @param listener

*/

public final void setFirstAutoPullUpToRefresh(OnRefreshListener listener) {

setRefreshingInternal(true, MODE_PULL_DOWN_TO_REFRESH);

listener.onRefresh(MODE_PULL_DOWN_TO_REFRESH);

}

/**

  • set refreshLable , default use null

  • @param pullLabel

  • @param releaseLabel

  • @param refreshingLabel

*/

public void setRefreshLabel(String pullLabel, String releaseLabel,

String refreshingLabel) {

if (pullLabel != null) {

setPullLabel(pullLabel);

}

if (releaseLabel != null) {

setReleaseLabel(releaseLabel);

}

if (refreshingLabel != null) {

setRefreshingLabel(refreshingLabel);

}

}

/**

  • A mutator to enable/disable Pull-to-Refresh for the current View

  • @param enable

  •        Whether Pull-To-Refresh should be used
    

*/

public final void setPullToRefreshEnabled(boolean enable) {

this.isPullToRefreshEnabled = enable;

}

/**

  • Set Text to show when the Widget is being pulled, and will refresh when

  • released

  • @param releaseLabel

  •        - String to display
    

*/

private void setReleaseLabel(String releaseLabel) {

if (null != headerLayout) {

headerLayout.setReleaseLabel(releaseLabel);

}

if (null != footerLayout) {

footerLayout.setReleaseLabel(releaseLabel);

}

}

/**

  • Set Text to show when the Widget is being Pulled

  • @param pullLabel

  •        - String to display
    

*/

private void setPullLabel(String pullLabel) {

if (null != headerLayout) {

headerLayout.setPullLabel(pullLabel);

}

if (null != footerLayout) {

footerLayout.setPullLabel(pullLabel);

}

}

/**

  • Set Text to show when the Widget

你可能感兴趣的:(程序员,面试,移动开发,android)