android.widget.ScrollView.measure()方法的使用及代码示例

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

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

ScrollView.measure介绍

暂无

代码示例

代码示例来源:origin: stackoverflow.com

ScrollView sc=new ScrollView(this);
sc.measure(400, 10);
    int width = sc.getMeasuredWidth();
    int height = sc.getMeasuredHeight();
    int left = 100;
    int top = 100;
      sc.layout(0, top, left + width, top + height);

代码示例来源:origin: antest1/kcanotify

@Override
  public void run() {
    sv.measure(ViewGroup.LayoutParams.WRAP_CONTENT, ViewGroup.LayoutParams.WRAP_CONTENT);
    scroll_h_total = sv.getMeasuredHeight();
    scroll_h_layout = sv.getHeight();
    sv.setOnTouchListener(new View.OnTouchListener() {
      @Override
      public boolean onTouch(View view, MotionEvent motionEvent) {
        switch (motionEvent.getAction()) {
          case MotionEvent.ACTION_DOWN:
            int y = (int) motionEvent.getY();
            int direction = 1;
            if (y < scroll_h_layout / 2) direction = -1;
            scroll_touch_count = 0;
            autoScrollScheduler = Executors.newSingleThreadScheduledExecutor();
            autoScrollScheduler.scheduleAtFixedRate(auto_scroll(direction), 800, 200, TimeUnit.MILLISECONDS);
            break;
          case MotionEvent.ACTION_UP:
            autoScrollScheduler.shutdown();
            break;
        }
        return false;
      }
    });
  }
});

代码示例来源:origin: WeAreFairphone/FP2-Launcher

protected void onMeasure(int widthMeasureSpec, int heightMeasureSpec) {
  int width = getPaddingLeft() + getPaddingRight() + mContent.getDesiredWidth();
  int height = getFolderHeight();
  int contentAreaWidthSpec = MeasureSpec.makeMeasureSpec(getContentAreaWidth(),
      MeasureSpec.EXACTLY);
  int contentAreaHeightSpec = MeasureSpec.makeMeasureSpec(getContentAreaHeight(),
      MeasureSpec.EXACTLY);
  if (LauncherAppState.isDisableAllApps()) {
    // Don't cap the height of the content to allow scrolling.
    mContent.setFixedSize(getContentAreaWidth(), mContent.getDesiredHeight());
  } else {
    mContent.setFixedSize(getContentAreaWidth(), getContentAreaHeight());
  }
  mScrollView.measure(contentAreaWidthSpec, contentAreaHeightSpec);
  mFolderName.measure(contentAreaWidthSpec,
      MeasureSpec.makeMeasureSpec(mFolderNameHeight, MeasureSpec.EXACTLY));
  setMeasuredDimension(width, height);
}

相关文章

ScrollView类方法