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

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

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

SwipeRefreshLayout.setProgressViewOffset介绍

[英]The refresh indicator starting and resting position is always positioned near the top of the refreshing content. This position is a consistent location, but can be adjusted in either direction based on whether or not there is a toolbar or actionbar present.
[中]刷新指示器开始和停止位置始终位于刷新内容的顶部附近。这个位置是一个一致的位置,但可以根据是否存在工具栏或操作栏在任意方向进行调整。

代码示例

代码示例来源:origin: jiangqqlmj/FastDev4Android

android.R.color.holo_red_light, android.R.color.holo_orange_light,
    android.R.color.holo_green_light);
demo_swiperefreshlayout.setProgressViewOffset(false, 0, (int) TypedValue
    .applyDimension(TypedValue.COMPLEX_UNIT_DIP, 24, getResources()
        .getDisplayMetrics()));

代码示例来源:origin: jiangqqlmj/FastDev4Android

android.R.color.holo_red_light, android.R.color.holo_orange_light,
    android.R.color.holo_green_light);
demo_swiperefreshlayout.setProgressViewOffset(false, 0, (int) TypedValue
    .applyDimension(TypedValue.COMPLEX_UNIT_DIP, 24, getResources()
        .getDisplayMetrics()));

代码示例来源:origin: jdsjlzx/LRecyclerView

mSwipeRefreshLayout.setProgressViewOffset(false, 0, AppUtil.dip2px(this,48));
mSwipeRefreshLayout.setColorSchemeResources(android.R.color.holo_blue_light, android.R.color.holo_red_light, android.R.color.holo_orange_light, android.R.color.holo_green_light);
mSwipeRefreshLayout.setOnRefreshListener(this);

代码示例来源:origin: GcsSloop/diycode

mRefreshLayout.setProgressViewOffset(false, -20, 80);
mRefreshLayout.setColorSchemeColors(getResources().getColor(R.color.diy_red));
mRefreshLayout.setEnabled(true);

代码示例来源:origin: happyheng/Sport_Android

/**
 * 设置SwipeRefreshLayout下拉刷新时开始的位置和结束的位置
 */
protected void setSwipeRefreshStartAndEnd(int start,int end){
  mRefreshLayout.setProgressViewOffset(false,start,end);
}

代码示例来源:origin: adgvcxz/Dribbble-MVVM

@BindingAdapter({"topMargin"})
  public static void setTopMargin(SwipeRefreshLayout swipeRefreshLayout, int topMargin) {
    swipeRefreshLayout.setProgressViewOffset(false, topMargin / 2, topMargin * 3 / 2);
  }
}

代码示例来源:origin: Werb/GankWithZhihu

private void setupSwipeRefresh(View view){
  mRefreshLayout = view.findViewById(R.id.swipe_refresh);
  if(mRefreshLayout != null){
    mRefreshLayout.setColorSchemeResources(R.color.refresh_progress_1,
        R.color.refresh_progress_2,R.color.refresh_progress_3);
    mRefreshLayout.setProgressViewOffset(true, 0, (int) TypedValue
        .applyDimension(TypedValue.COMPLEX_UNIT_DIP, 24,getResources().getDisplayMetrics()));
    mRefreshLayout.setOnRefreshListener(this::requestDataRefresh);
  }
}

代码示例来源:origin: werbhelius/Werb

private void setupSwipeRefresh(View view){
  mRefreshLayout = (SwipeRefreshLayout) view.findViewById(R.id.swipe_refresh);
  if(mRefreshLayout != null){
    mRefreshLayout.setColorSchemeResources(R.color.refresh_progress_1,
        R.color.refresh_progress_2,R.color.refresh_progress_3);
    mRefreshLayout.setProgressViewOffset(true, 0, (int) TypedValue
        .applyDimension(TypedValue.COMPLEX_UNIT_DIP, 24,getResources().getDisplayMetrics()));
    mRefreshLayout.setOnRefreshListener(this::requestDataRefresh);
  }
}

代码示例来源:origin: ashishbhandari/RetailStore

private void updateSwipeRefreshProgressBarTop() {
  if (mSwipeRefreshLayout == null) {
    return;
  }
  int progressBarStartMargin = getResources().getDimensionPixelSize(
      R.dimen.swipe_refresh_progress_bar_start_margin);
  int progressBarEndMargin = getResources().getDimensionPixelSize(
      R.dimen.swipe_refresh_progress_bar_end_margin);
  int top = mActionBarShown ? mProgressBarTopWhenActionBarShown : 0;
  mSwipeRefreshLayout.setProgressViewOffset(false,
      top + progressBarStartMargin, top + progressBarEndMargin);
}

代码示例来源:origin: Werb/GankWithZhihu

private void setupSwipeRefresh() {
  mRefreshLayout = findViewById(R.id.swipe_refresh);
  if (mRefreshLayout != null) {
    mRefreshLayout.setColorSchemeResources(R.color.refresh_progress_1,
        R.color.refresh_progress_2, R.color.refresh_progress_3);
    mRefreshLayout.setProgressViewOffset(true, 0, (int) TypedValue
        .applyDimension(TypedValue.COMPLEX_UNIT_DIP, 24, getResources().getDisplayMetrics()));
    mRefreshLayout.setOnRefreshListener(this::requestDataRefresh);
  }
}

代码示例来源:origin: werbhelius/Werb

private void setupSwipeRefresh(){
  mRefreshLayout = (SwipeRefreshLayout)findViewById(R.id.swipe_refresh);
  if(mRefreshLayout != null){
    mRefreshLayout.setColorSchemeResources(R.color.refresh_progress_1,
        R.color.refresh_progress_2,R.color.refresh_progress_3);
    mRefreshLayout.setProgressViewOffset(true, 0, (int) TypedValue
        .applyDimension(TypedValue.COMPLEX_UNIT_DIP, 24,getResources().getDisplayMetrics()));
    mRefreshLayout.setOnRefreshListener(this::requestDataRefresh);
  }
}

代码示例来源:origin: marcoRS/rxjava-essentials

@Override public void onViewCreated(View view, Bundle savedInstanceState) {
 super.onViewCreated(view, savedInstanceState);
 ButterKnife.inject(this, view);
 mRecyclerView.setLayoutManager(new LinearLayoutManager(view.getContext()));
 mAdapter = new ApplicationAdapter(new ArrayList<>(), R.layout.applications_list_item);
 mRecyclerView.setAdapter(mAdapter);
 mSwipeRefreshLayout.setColorSchemeColors(getResources().getColor(R.color.myPrimaryColor));
 mSwipeRefreshLayout.setProgressViewOffset(false, 0,
   (int) TypedValue.applyDimension(TypedValue.COMPLEX_UNIT_DIP, 24,
     getResources().getDisplayMetrics()));
 mSwipeRefreshLayout.setEnabled(false);
 mSwipeRefreshLayout.setRefreshing(true);
 mRecyclerView.setVisibility(View.GONE);
 loadList();
}

代码示例来源:origin: marcoRS/rxjava-essentials

@Override public void onViewCreated(View view, Bundle savedInstanceState) {
 super.onViewCreated(view, savedInstanceState);
 ButterKnife.inject(this, view);
 mRecyclerView.setLayoutManager(new LinearLayoutManager(view.getContext()));
 mAdapter = new ApplicationAdapter(new ArrayList<>(), R.layout.applications_list_item);
 mRecyclerView.setAdapter(mAdapter);
 mSwipeRefreshLayout.setColorSchemeColors(getResources().getColor(R.color.myPrimaryColor));
 mSwipeRefreshLayout.setProgressViewOffset(false, 0,
   (int) TypedValue.applyDimension(TypedValue.COMPLEX_UNIT_DIP, 24,
     getResources().getDisplayMetrics()));
 // Progress
 mSwipeRefreshLayout.setEnabled(false);
 mSwipeRefreshLayout.setRefreshing(true);
 mRecyclerView.setVisibility(View.GONE);
 List<AppInfo> apps = ApplicationsList.getInstance().getList();
 loadList(apps);
}

代码示例来源:origin: marcoRS/rxjava-essentials

@Override public void onViewCreated(View view, Bundle savedInstanceState) {
 super.onViewCreated(view, savedInstanceState);
 ButterKnife.inject(this, view);
 mRecyclerView.setLayoutManager(new LinearLayoutManager(view.getContext()));
 mAdapter = new ApplicationAdapter(new ArrayList<>(), R.layout.applications_list_item);
 mRecyclerView.setAdapter(mAdapter);
 mSwipeRefreshLayout.setColorSchemeColors(getResources().getColor(R.color.myPrimaryColor));
 mSwipeRefreshLayout.setProgressViewOffset(false, 0,
   (int) TypedValue.applyDimension(TypedValue.COMPLEX_UNIT_DIP, 24,
     getResources().getDisplayMetrics()));
 // Progress
 mSwipeRefreshLayout.setEnabled(false);
 mSwipeRefreshLayout.setRefreshing(true);
 mRecyclerView.setVisibility(View.GONE);
 List<AppInfo> apps = ApplicationsList.getInstance().getList();
 loadList(apps);
}

代码示例来源:origin: marcoRS/rxjava-essentials

@Override public void onViewCreated(View view, Bundle savedInstanceState) {
 super.onViewCreated(view, savedInstanceState);
 ButterKnife.inject(this, view);
 mRecyclerView.setLayoutManager(new LinearLayoutManager(view.getContext()));
 mAdapter = new ApplicationAdapter(new ArrayList<>(), R.layout.applications_list_item);
 mRecyclerView.setAdapter(mAdapter);
 mSwipeRefreshLayout.setColorSchemeColors(getResources().getColor(R.color.myPrimaryColor));
 mSwipeRefreshLayout.setProgressViewOffset(false, 0,
   (int) TypedValue.applyDimension(TypedValue.COMPLEX_UNIT_DIP, 24,
     getResources().getDisplayMetrics()));
 // Progress
 mSwipeRefreshLayout.setEnabled(false);
 mSwipeRefreshLayout.setRefreshing(true);
 mRecyclerView.setVisibility(View.GONE);
 List<AppInfo> apps = ApplicationsList.getInstance().getList();
 loadList(apps);
}

代码示例来源:origin: marcoRS/rxjava-essentials

@Override public void onViewCreated(View view, Bundle savedInstanceState) {
 super.onViewCreated(view, savedInstanceState);
 ButterKnife.inject(this, view);
 mRecyclerView.setLayoutManager(new LinearLayoutManager(view.getContext()));
 mAdapter = new ApplicationAdapter(new ArrayList<>(), R.layout.applications_list_item);
 mRecyclerView.setAdapter(mAdapter);
 mSwipeRefreshLayout.setColorSchemeColors(getResources().getColor(R.color.myPrimaryColor));
 mSwipeRefreshLayout.setProgressViewOffset(false, 0,
   (int) TypedValue.applyDimension(TypedValue.COMPLEX_UNIT_DIP, 24,
     getResources().getDisplayMetrics()));
 // Progress
 mSwipeRefreshLayout.setEnabled(false);
 mSwipeRefreshLayout.setRefreshing(true);
 mRecyclerView.setVisibility(View.GONE);
 List<AppInfo> apps = ApplicationsList.getInstance().getList();
 loadList(apps);
}

代码示例来源:origin: marcoRS/rxjava-essentials

@Override public void onViewCreated(View view, Bundle savedInstanceState) {
 super.onViewCreated(view, savedInstanceState);
 ButterKnife.inject(this, view);
 mRecyclerView.setLayoutManager(new LinearLayoutManager(view.getContext()));
 mAdapter = new ApplicationAdapter(new ArrayList<>(), R.layout.applications_list_item);
 mRecyclerView.setAdapter(mAdapter);
 mSwipeRefreshLayout.setColorSchemeColors(getResources().getColor(R.color.myPrimaryColor));
 mSwipeRefreshLayout.setProgressViewOffset(false, 0,
   (int) TypedValue.applyDimension(TypedValue.COMPLEX_UNIT_DIP, 24,
     getResources().getDisplayMetrics()));
 // Progress
 mSwipeRefreshLayout.setEnabled(false);
 mSwipeRefreshLayout.setRefreshing(true);
 mRecyclerView.setVisibility(View.GONE);
 List<AppInfo> apps = ApplicationsList.getInstance().getList();
 loadList(apps);
}

代码示例来源:origin: gdutxiaoxu/CoordinatorLayoutExample

private void initView(){
  Toolbar toolbar = (Toolbar) findViewById(R.id.toolbar);
  setSupportActionBar(toolbar);
  coordinatorLayout=(CoordinatorLayout)findViewById(R.id.behavior_demo_coordinatorLayout);
  recyclerview=(RecyclerView)findViewById(R.id.behavior_demo_recycler);
  mLayoutManager=new StaggeredGridLayoutManager(2, StaggeredGridLayoutManager.VERTICAL);
  recyclerview.setLayoutManager(mLayoutManager);
  swipeRefreshLayout=(SwipeRefreshLayout) findViewById(R.id.behavior_demo_swipe_refresh) ;
  swipeRefreshLayout.setProgressViewOffset(false, 0,  (int) TypedValue.applyDimension(TypedValue.COMPLEX_UNIT_DIP, 24, getResources().getDisplayMetrics()));//调整下拉控件位置
  fab=(FloatingActionButton) findViewById(R.id.fab);
}

代码示例来源:origin: gdutxiaoxu/CoordinatorLayoutExample

private void initView(){
  Toolbar toolbar = (Toolbar) findViewById(R.id.toolbar);
  setSupportActionBar(toolbar);
  coordinatorLayout=(CoordinatorLayout)findViewById(R.id.bottom_sheet_demo_coordinatorLayout);
  recyclerview=(RecyclerView)findViewById(R.id.bottom_sheet_demo_recycler);
  mLayoutManager=new StaggeredGridLayoutManager(2, StaggeredGridLayoutManager.VERTICAL);
  recyclerview.setLayoutManager(mLayoutManager);
  swipeRefreshLayout=(SwipeRefreshLayout) findViewById(R.id.bottom_sheet_demo_swipe_refresh) ;
  swipeRefreshLayout.setProgressViewOffset(false, 0,  (int) TypedValue.applyDimension(TypedValue.COMPLEX_UNIT_DIP, 24, getResources().getDisplayMetrics()));//调整下拉控件位置
  design_bottom_sheet_bar=(RelativeLayout) findViewById(R.id.design_bottom_sheet_bar);
  design_bottom_sheet=(RelativeLayout) findViewById(R.id.design_bottom_sheet);
  bottom_sheet_iv=(ImageView) findViewById(R.id.bottom_sheet_iv);
  bottom_sheet_tv=(TextView) findViewById(R.id.bottom_sheet_tv);
  behavior = BottomSheetBehavior.from(design_bottom_sheet);
}

代码示例来源:origin: gdutxiaoxu/CoordinatorLayoutExample

private void initView(){
  Toolbar toolbar = (Toolbar) findViewById(R.id.toolbar);
  setSupportActionBar(toolbar);
  coordinatorLayout=(CoordinatorLayout)findViewById(R.id.bottom_sheet_demo_coordinatorLayout);
  recyclerview=(RecyclerView)findViewById(R.id.bottom_sheet_demo_recycler);
  mLayoutManager=new StaggeredGridLayoutManager(2, StaggeredGridLayoutManager.VERTICAL);
  recyclerview.setLayoutManager(mLayoutManager);
  swipeRefreshLayout=(SwipeRefreshLayout) findViewById(R.id.bottom_sheet_demo_swipe_refresh) ;
  swipeRefreshLayout.setProgressViewOffset(false, 0,  (int) TypedValue.applyDimension(TypedValue.COMPLEX_UNIT_DIP, 24, getResources().getDisplayMetrics()));//调整下拉控件位置
  design_bottom_sheet_bar=(RelativeLayout) findViewById(R.id.design_bottom_sheet_bar);
  design_bottom_sheet=(RelativeLayout) findViewById(R.id.design_bottom_sheet);
  bottom_sheet_iv=(ImageView) findViewById(R.id.bottom_sheet_iv);
  bottom_sheet_tv=(TextView) findViewById(R.id.bottom_sheet_tv);
  behavior = BottomSheetBehavior.from(design_bottom_sheet);
}

相关文章