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

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

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

SwipeRefreshLayout.setBackgroundColor介绍

暂无

代码示例

代码示例来源:origin: GitLqr/MaterialDesignDemo

private void setSwipeRefreshLayout() {
  //设置 SwipeRefreshLayout 的尺寸
  mSrl.setSize(SwipeRefreshLayout.LARGE);
  //设置 SwipeRefreshLayout 刷新时的颜色切换(可以有无数种)
  mSrl.setColorSchemeColors(Color.RED, Color.YELLOW, Color.GREEN);
  //设置 SwipeRefreshLayout 的背景色
  mSrl.setBackgroundColor(Color.GRAY);
  //设置 SwipeRefreshLayout 的下拉距离
  mSrl.setDistanceToTriggerSync(100);
  //设置 SwipeRefreshLayout 正在刷新监听
  mSrl.setOnRefreshListener(new SwipeRefreshLayout.OnRefreshListener() {
    @Override
    public void onRefresh() {
      for (int i = 0; i < 10; i++) {
        mData.add(0, (++number) + "");
      }
      mHandler.postDelayed(new Runnable() {
        @Override
        public void run() {
          mHandler.sendEmptyMessage(0);
        }
      }, 3000);
    }
  });
}

代码示例来源:origin: nyakokishi/ZhihuDaily

mRefreshLayout.setBackgroundColor(getResources().getColor(R.color.home_background));
} else {
  if (TextUtils.isEmpty(background)) {

代码示例来源:origin: nyakokishi/ZhihuDaily

@Override
public boolean onOptionsItemSelected(MenuItem item) {
  int id = item.getItemId();
  if (id == R.id.action_custom_mode) {
    Intent intent = new Intent(Intent.ACTION_PICK, android.provider.MediaStore.Images.Media.EXTERNAL_CONTENT_URI);
    startActivityForResult(intent, Constant.ALBUTM);
  }
  if (id == R.id.action_scenery_mode) {
    isColorTheme = false;
    mLinearLayout.setBackground(getResources().getDrawable(R.drawable.main_background));
    mToolbar.setBackgroundColor(getResources().getColor(android.R.color.transparent));
    currentFragment.updateTheme(isColorTheme, null);
    ((MenuFragment) getSupportFragmentManager().findFragmentById(R.id.menu_fragment))
        .updateTheme(isColorTheme, null);
    PreferenceUtil.setPrefBoolean(getApplicationContext(), "isColorTheme", isColorTheme);
    PreferenceUtil.setPrefString(getApplicationContext(), "background", "");
  }
  if (id == R.id.action_light_mode) {
    isColorTheme = true;
    mLinearLayout.setBackground(null);
    mToolbar.setBackgroundColor(getResources().getColor(R.color.blue));
    mRefreshLayout.setBackgroundColor(getResources().getColor(R.color.home_background));
    currentFragment.updateTheme(isColorTheme, null);
    ((MenuFragment) getSupportFragmentManager().findFragmentById(R.id.menu_fragment))
        .updateTheme(isColorTheme, null);
    PreferenceUtil.setPrefBoolean(getApplicationContext(), "isColorTheme", isColorTheme);
    PreferenceUtil.setPrefString(getApplicationContext(), "background", "");
  }
  return super.onOptionsItemSelected(item);
}

相关文章