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

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

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

SwipeRefreshLayout.setProgressViewEndTarget介绍

[英]The refresh indicator 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: wangjjj/TallyBook

@Override
protected void initEventAndData() {
  PieChartUtil.initPieChart(mChart);
  mChart.setOnChartValueSelectedListener(this);
  dataYear.setText(DateUtils.getCurYear("yyyy 年"));
  dataMonth.setText(DateUtils.date2Str(new Date(), "MM"));
  //改变加载显示的颜色
  swipe.setColorSchemeColors(getResources().getColor(R.color.text_red), getResources().getColor(R.color.text_red));
  //设置向下拉多少出现刷新
  swipe.setDistanceToTriggerSync(200);
  //设置刷新出现的位置
  swipe.setProgressViewEndTarget(false, 200);
  swipe.setOnRefreshListener(new SwipeRefreshLayout.OnRefreshListener() {
    @Override
    public void onRefresh() {
      swipe.setRefreshing(false);
      PieChartUtil.setAnimate(mChart);
    }
  });
  rvList.setLayoutManager(new LinearLayoutManager(getActivity()));
  list = new ArrayList<>();
  adapter = new TallyTypeRankAdapter(getActivity(), list);
  rvList.setAdapter(adapter);
  setReportData();
}

代码示例来源:origin: wangjjj/TallyBook

@Override
protected void initEventAndData() {
  dataYear.setText(DateUtils.getCurYear("yyyy 年"));
  dataMonth.setText(DateUtils.date2Str(new Date(), "MM"));
  //改变加载显示的颜色
  swipe.setColorSchemeColors(getResources().getColor(R.color.text_red), getResources().getColor(R.color.text_red));
  //设置向下拉多少出现刷新
  swipe.setDistanceToTriggerSync(200);
  //设置刷新出现的位置
  swipe.setProgressViewEndTarget(false, 200);
  swipe.setOnRefreshListener(new SwipeRefreshLayout.OnRefreshListener() {
    @Override
    public void onRefresh() {
      swipe.setRefreshing(false);
    }
  });
  rvList.setLayoutManager(new LinearLayoutManager(getActivity()));
  adapter = new TallyAccountAdapter(getActivity(), list);
  adapter.setmListener(new TallyAccountAdapter.OnItemClickListener() {
    @Override
    public void onItemClick(int position) {
    }
  });
  rvList.setAdapter(adapter);
  //test data---------------
  setTestData();
}

代码示例来源:origin: wangjjj/TallyBook

swipe.setProgressViewEndTarget(false, 200);
swipe.setOnRefreshListener(new SwipeRefreshLayout.OnRefreshListener() {
  @Override

代码示例来源:origin: woxingxiao/GracefulMovies

@Override
protected void afterSetContentView() {
  initializeToolbar();
  mBinding.fab.setOnClickListener(view -> {
    if (mAdapter.getData() != null && !mAdapter.getData().isEmpty())
      mBinding.recyclerView.smoothScrollToPosition(0);
  });
  mBinding.swipeRefreshLayout.setColorSchemeColors(
      ContextCompat.getColor(this, R.color.colorAccent),
      ContextCompat.getColor(this, R.color.colorPrimary)
  );
  mBinding.swipeRefreshLayout.setProgressViewEndTarget(false, (int) TypedValue.applyDimension(
      TypedValue.COMPLEX_UNIT_DIP, 80, Resources.getSystem().getDisplayMetrics()));
  mBinding.swipeRefreshLayout.setOnRefreshListener(this);
  mAdapter = new BoxOfficeAdapter();
  mBinding.recyclerView.setAdapter(mAdapter);
  mViewModel = ViewModelProviders.of(this).get(BoxOfficeViewModel.class);
  mViewModel.getBoxOffices().observe(this, resource -> {
    assert resource != null;
    processStatusView(resource);
    if (resource.getStatus() != DataResource.Status.LOADING) {
      mBinding.swipeRefreshLayout.setRefreshing(false);
      mAdapter.setData(resource.getData());
    }
  });
  mBinding.swipeRefreshLayout.setRefreshing(true);
  mViewModel.load();
}

代码示例来源:origin: blockchain/Android-Merchant-App

@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
  View rootView = inflater.inflate(getResources().getLayout(R.layout.fragment_transaction), container, false);
  initListView(rootView);
  merchantXpub = PrefsUtil.getInstance(getActivity()).getValue(PrefsUtil.MERCHANT_KEY_MERCHANT_RECEIVER, "");
  push_notifications = PrefsUtil.getInstance(getActivity()).getValue(PrefsUtil.MERCHANT_KEY_PUSH_NOTIFS, false);
  doBTC = PrefsUtil.getInstance(getActivity()).getValue(PrefsUtil.MERCHANT_KEY_CURRENCY_DISPLAY, false);
  btc_font = TypefaceUtil.getInstance(getActivity()).getTypeface();
  swipeLayout = (SwipeRefreshLayout) rootView.findViewById(R.id.swipe_container);
  swipeLayout.setProgressViewEndTarget(false, (int) (getResources().getDisplayMetrics().density * (72 + 20)));
  swipeLayout.setOnRefreshListener(new SwipeRefreshLayout.OnRefreshListener() {
    @Override
    public void onRefresh() {
      new GetDataTask().execute();
    }
  });
  swipeLayout.setColorScheme(R.color.blockchain_blue,
      R.color.blockchain_green,
      R.color.blockchain_dark_blue);
  thisActivity = getActivity();
  return rootView;
}

相关文章