android.support.v4.widget.SwipeRefreshLayout.<init>()方法的使用及代码示例

x33g5p2x  于2022-01-29 转载在 其他  
字(3.9k)|赞(0)|评价(0)|浏览(113)

本文整理了Java中android.support.v4.widget.SwipeRefreshLayout.<init>()方法的一些代码示例,展示了SwipeRefreshLayout.<init>()的具体用法。这些代码示例主要来源于Github/Stackoverflow/Maven等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。SwipeRefreshLayout.<init>()方法的具体详情如下:
包路径:android.support.v4.widget.SwipeRefreshLayout
类名称:SwipeRefreshLayout
方法名:<init>

SwipeRefreshLayout.<init>介绍

[英]Simple constructor to use when creating a SwipeRefreshLayout from code.
[中]从代码创建布局时使用的简单构造函数。

代码示例

代码示例来源:origin: robolectric/robolectric

@Test
 public void getOnRefreshListener_shouldReturnTheListener() {
  final OnRefreshListener listener = mock(OnRefreshListener.class);

  final SwipeRefreshLayout layout = new SwipeRefreshLayout(RuntimeEnvironment.application);
  layout.setOnRefreshListener(listener);

  assertThat(shadowOf(layout).getOnRefreshListener()).isSameAs(listener);
 }
}

代码示例来源:origin: ISchwarz23/SortableTableView

private void setupTableDataView(final AttributeSet attributes, final int styleAttributes) {
  final LayoutParams dataViewLayoutParams = new LayoutParams(getWidthAttribute(attributes), LayoutParams.MATCH_PARENT);
  if (isInEditMode()) {
    tableDataAdapter = new EditModeTableDataAdapter(getContext());
  } else {
    tableDataAdapter = new DefaultTableDataAdapter(getContext());
  }
  tableDataAdapter.setRowBackgroundProvider(dataRowBackgroundProvider);
  tableDataView = new ListView(getContext(), attributes, styleAttributes);
  tableDataView.setOnItemClickListener(new InternalDataClickListener());
  tableDataView.setOnItemLongClickListener(new InternalDataLongClickListener());
  tableDataView.setLayoutParams(new LayoutParams(LayoutParams.MATCH_PARENT, LayoutParams.MATCH_PARENT));
  tableDataView.setAdapter(tableDataAdapter);
  tableDataView.setId(R.id.table_data_view);
  tableDataView.setOnScrollListener(new InternalOnScrollListener());
  swipeRefreshLayout = new SwipeRefreshLayout(getContext());
  swipeRefreshLayout.setLayoutParams(dataViewLayoutParams);
  swipeRefreshLayout.addView(tableDataView);
  swipeRefreshLayout.setColorSchemeColors(headerColor);
  swipeRefreshLayout.setEnabled(false);
  addView(swipeRefreshLayout);
}

代码示例来源:origin: z3896823/PanelList

/**
 * 这里有点蛋疼,因为控件是在initAdapter中赋值的,但是这里要用
 * 所以如果开发者在setAdapter之前调用了该方法,则必须对控件进行赋值
 * 但如果赋值了,还得判断开发者是否设置了初始位置,因为控件默认开启,如果初始位置不为0,则控件启用
 * 这样会造成在中间阶段下拉会触发监听,因此对initPosition再进行一次判断
 * 当用户发生了滑动操作,控件的状态会被随即改变
 *
 * @param listener
 */
public void setOnRefreshListener(SwipeRefreshLayout.OnRefreshListener listener) {
  this.onRefreshListener = listener;
  if (swipeRefreshLayout == null) {
    swipeRefreshLayout = new SwipeRefreshLayout(context);
    if (initPosition != 0) {
      swipeRefreshLayout.setEnabled(false);
    }
  }
  swipeRefreshLayout.setOnRefreshListener(listener);
  Log.d(TAG, "setOnRefreshListener: " + onRefreshListener.toString());
}

代码示例来源:origin: Wilm0r/giggity

refresher = new SwipeRefreshLayout(this);
refresher.setOnRefreshListener(this);
refresher.addView(list);

代码示例来源:origin: xfshipan/miappstore

@Nullable
@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
  if (swipeRefreshLayout == null) {
    swipeRefreshLayout = new SwipeRefreshLayout(getContext());
    loadPage = new LoadPage(getActivity()) {
      @Override
      protected LoadResult loadServer() {
        return BaseViewPagerFragment.this.loadData();
      }
      @Override
      protected View createSuccessView() {
        return BaseViewPagerFragment.this.createSuccessView();
      }
    };
    swipeRefreshLayout.addView(loadPage);
  } else {
    //如果loadPage不为空,首先移除之前loadPage之前的父控件
    example.xfsp.miappstore.utils.ViewUtils.removeParent(swipeRefreshLayout);
  }
  swipeRefreshLayout.setColorSchemeResources(android.R.color.holo_blue_bright,
      android.R.color.holo_green_light,
      android.R.color.holo_orange_light,
      android.R.color.holo_red_light);
  return swipeRefreshLayout;
}

代码示例来源:origin: JustinRoom/JSCKit

private void init(Context context) {
  swipeRefreshLayout = new SwipeRefreshLayout(context);
  swipeRefreshLayout.setColorSchemeColors(0xFF3F51B5, 0xFF303F9F);
  swipeRefreshLayout.setOnRefreshListener(new SwipeRefreshLayout.OnRefreshListener() {

代码示例来源:origin: z3896823/PanelList

swipeRefreshLayout = new SwipeRefreshLayout(context);

相关文章