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

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

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

SwipeRefreshLayout.getHeight介绍

暂无

代码示例

代码示例来源:origin: ckcz123/PKUHelper-Android

@SuppressLint("NewApi")
  @SuppressWarnings("deprecation")
  @Override
  public void onGlobalLayout() {
    int width = swipeRefreshLayout.getWidth(), height = swipeRefreshLayout.getHeight();
    if (width != 0 && height != 0) {
      ViewSetting.setBackground(HoleActivity.this, swipeRefreshLayout,
          R.drawable.chat_bg);
      if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.JELLY_BEAN) {
        swipeRefreshLayout.getViewTreeObserver().removeOnGlobalLayoutListener(this);
      } else {
        swipeRefreshLayout.getViewTreeObserver().removeGlobalOnLayoutListener(this);
      }
    }
  }
});

代码示例来源:origin: ckcz123/PKUHelper-Android

@SuppressLint("NewApi")
  @SuppressWarnings("deprecation")
  @Override
  public void onGlobalLayout() {
    int width = swipeRefreshLayout.getWidth(), height = swipeRefreshLayout.getHeight();
    if (width != 0 && height != 0) {
      ViewSetting.setBackground(LostFoundActivity.this, swipeRefreshLayout,
          R.drawable.chat_bg);
      if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.JELLY_BEAN) {
        swipeRefreshLayout.getViewTreeObserver().removeOnGlobalLayoutListener(this);
      } else {
        swipeRefreshLayout.getViewTreeObserver().removeGlobalOnLayoutListener(this);
      }
    }
  }
});

代码示例来源:origin: ckcz123/PKUHelper-Android

@SuppressLint("NewApi")
  @SuppressWarnings("deprecation")
  @Override
  public void onGlobalLayout() {
    int width = swipeRefreshLayout.getWidth(), height = swipeRefreshLayout.getHeight();
    if (width != 0 && height != 0) {
      screenHeight = height;
      screenWidth = width;
      ViewSetting.setBackground(NCActivity.this, swipeRefreshLayout,
          R.drawable.chat_bg);
      if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.JELLY_BEAN) {
        swipeRefreshLayout.getViewTreeObserver().removeOnGlobalLayoutListener(this);
      } else {
        swipeRefreshLayout.getViewTreeObserver().removeGlobalOnLayoutListener(this);
      }
    }
  }
});

代码示例来源:origin: googlesamples/android-SwipeRefreshListFragment

/**
 * Test that swiping on the populated list triggers a refresh.
 */
public void testSwipingListView() {
  // Given a SwipeRefreshLayout which is displaying a populated list
  // When the swipe refresh layout is dragged
  TouchUtils.dragViewBy(this,
      mSwipeRefreshLayout,
      Gravity.TOP | Gravity.CENTER_HORIZONTAL,
      0,
      Math.round(mSwipeRefreshLayout.getHeight() * 0.4f));
  // Then the SwipeRefreshLayout should be refreshing
  // We need to use runOnMainSync here as fake dragging uses waitForIdleSync()
  getInstrumentation().runOnMainSync(new Runnable() {
    @Override
    public void run() {
      assertTrue(mSwipeRefreshLayout.isRefreshing());
    }
  });
}

代码示例来源:origin: googlesamples/android-SwipeRefreshLayoutBasic

/**
 * Test that swiping on the populated list triggers a refresh.
 */
public void testSwipingListView() {
  // Given a SwipeRefreshLayout which is displaying a populated list
  // When the swipe refresh layout is dragged
  TouchUtils.dragViewBy(this,
      mSwipeRefreshLayout,
      Gravity.CENTER,
      0,
      Math.round(mSwipeRefreshLayout.getHeight() * 0.4f));
  // Then the SwipeRefreshLayout should be refreshing
  // We need to use runOnMainSync here as fake dragging uses waitForIdleSync()
  getInstrumentation().runOnMainSync(new Runnable() {
    @Override
    public void run() {
      assertTrue(mSwipeRefreshLayout.isRefreshing());
    }
  });
}

相关文章