android.view.View.getMeasuredWidthAndState()方法的使用及代码示例

x33g5p2x  于2022-01-17 转载在 其他  
字(5.6k)|赞(0)|评价(0)|浏览(229)

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

View.getMeasuredWidthAndState介绍

暂无

代码示例

代码示例来源:origin: ZieIony/Carbon

private static boolean shouldHandleMeasuredWidthTooSmall(View view, PercentLayoutInfo info) {
  int state = view.getMeasuredWidthAndState() & View.MEASURED_STATE_MASK;
  return state == View.MEASURED_STATE_TOO_SMALL && info.widthPercent >= 0 &&
      info.mPreservedParams.width == ViewGroup.LayoutParams.WRAP_CONTENT;
}

代码示例来源:origin: square/assertj-android

@TargetApi(HONEYCOMB)
public S hasMeasuredWidthAndState(int widthAndState) {
 isNotNull();
 int actualWidthAndState = actual.getMeasuredWidthAndState();
 assertThat(actualWidthAndState) //
   .overridingErrorMessage("Expected measured width and state <%s> but was <%s>",
     widthAndState, actualWidthAndState) //
   .isEqualTo(widthAndState);
 return myself;
}

代码示例来源:origin: kingargyle/adt-leanback-support

public static int getMeasuredWidthAndState(View view) {
  return view.getMeasuredWidthAndState();
}

代码示例来源:origin: com.squareup.assertj/assertj-android

@TargetApi(HONEYCOMB)
public S hasMeasuredWidthAndState(int widthAndState) {
 isNotNull();
 int actualWidthAndState = actual.getMeasuredWidthAndState();
 assertThat(actualWidthAndState) //
   .overridingErrorMessage("Expected measured width and state <%s> but was <%s>",
     widthAndState, actualWidthAndState) //
   .isEqualTo(widthAndState);
 return myself;
}

代码示例来源:origin: HelloChenJinJun/TestChat

int contentViewHeight = 0;
if (mContentView != null) {
    int contentViewWidth = mContentView.getMeasuredWidthAndState();
    contentViewHeight = mContentView.getMeasuredHeightAndState();
    LayoutParams lp = (LayoutParams) mContentView.getLayoutParams();
    int menuViewWidth = leftMenu.getMeasuredWidthAndState();
    int menuViewWidth = rightMenu.getMeasuredWidthAndState();

代码示例来源:origin: Simon-Leeeeeeeee/SLWidget

@Override
protected void onMeasure(int widthMeasureSpec, int heightMeasureSpec) {
  super.onMeasure(widthMeasureSpec, heightMeasureSpec);
  int measuredWidth = getMeasuredWidth();
  View tabsContainer = getChildAt(0);
  if (tabsContainer != null) {
    int measuredWidthAndState, measuredHeightAndState;
    ViewGroup.LayoutParams lp = tabsContainer.getLayoutParams();
    if (lp.width == LayoutParams.MATCH_PARENT && measuredWidth - getPaddingLeft() - getPaddingRight() > tabsContainer.getMeasuredWidth()) {//tabsContainer宽度不够,让其充满SlidingTabLayout
      measuredWidthAndState = MeasureSpec.makeMeasureSpec(measuredWidth - getPaddingLeft() - getPaddingRight(), MeasureSpec.EXACTLY);
    } else if (lp.width != LayoutParams.MATCH_PARENT && lp.width != LayoutParams.WRAP_CONTENT) {//tabsContainer指定了宽度值,使其生效
      measuredWidthAndState = MeasureSpec.makeMeasureSpec(lp.width, MeasureSpec.EXACTLY);
    } else if (lp.height != LayoutParams.WRAP_CONTENT) {//高度不是自适应,说明需要重新测量高度,宽度不做调整
      measuredWidthAndState = tabsContainer.getMeasuredWidthAndState();
    } else {
      return;
    }
    if (lp.height == LayoutParams.MATCH_PARENT) {//tabsContainer指定最大高度,使其生效
      measuredHeightAndState = MeasureSpec.makeMeasureSpec(getMeasuredHeight() - getPaddingTop() - getPaddingBottom(), MeasureSpec.EXACTLY);
    } else if (lp.height != LayoutParams.WRAP_CONTENT) {//tabsContainer指定高度值,使其生效
      measuredHeightAndState = MeasureSpec.makeMeasureSpec(lp.height, MeasureSpec.EXACTLY);
    } else {
      measuredHeightAndState = tabsContainer.getMeasuredHeightAndState();
    }
    tabsContainer.measure(measuredWidthAndState, measuredHeightAndState);
  }
}

代码示例来源:origin: TUBB/SwipeMenu

int contentViewWidth = mContentView.getMeasuredWidthAndState();
int contentViewHeight = mContentView.getMeasuredHeightAndState();
LayoutParams lp = (LayoutParams) mContentView.getLayoutParams();
  int menuViewWidth = mEndSwiper.getMenuView().getMeasuredWidthAndState();
  int menuViewHeight = mEndSwiper.getMenuView().getMeasuredHeightAndState();
  lp = (LayoutParams) mEndSwiper.getMenuView().getLayoutParams();
  int menuViewWidth = mBeginSwiper.getMenuView().getMeasuredWidthAndState();
  int menuViewHeight = mBeginSwiper.getMenuView().getMeasuredHeightAndState();
  lp = (LayoutParams) mBeginSwiper.getMenuView().getLayoutParams();

代码示例来源:origin: TUBB/SwipeMenu

@Override
protected void onLayout(boolean changed, int l, int t, int r, int b) {
  int parentViewWidth = getMeasuredWidthAndState();
  int contentViewWidth = mContentView.getMeasuredWidthAndState();
  int contentViewHeight = mContentView.getMeasuredHeightAndState();
  LayoutParams lp = (LayoutParams) mContentView.getLayoutParams();
      tGap + contentViewHeight);
  if (mEndSwiper != null) {
    int menuViewWidth = mEndSwiper.getMenuView().getMeasuredWidthAndState();
    int menuViewHeight = mEndSwiper.getMenuView().getMeasuredHeightAndState();
    lp = (LayoutParams) mEndSwiper.getMenuView().getLayoutParams();
    int menuViewWidth = mBeginSwiper.getMenuView().getMeasuredWidthAndState();
    int menuViewHeight = mBeginSwiper.getMenuView().getMeasuredHeightAndState();
    lp = (LayoutParams) mBeginSwiper.getMenuView().getLayoutParams();

代码示例来源:origin: Simon-Leeeeeeeee/SLWidget

} else if (matchWidth) {//宽度填满单元格
  childWidthMeasureSpec = columnNum > mRemnantWidth ? gridCellMeasureSpec_Width : gridCellMeasureSpec_WidthPlus;
  childHeightMeasureSpec = skipMeasure ? getChildHeightMeasureSpec(heightMeasureSpec, lp, true) : child.getMeasuredWidthAndState();
} else if (matchHeight) {//高度填满单元格
  childWidthMeasureSpec = skipMeasure ? getChildWidthMeasureSpec(widthMeasureSpec, lp, true) : child.getMeasuredHeightAndState();

代码示例来源:origin: jbruchanov/AnUitor

data.put("MeasuredHeightAndState", v.getMeasuredHeightAndState());
data.put("MeasuredState", v.getMeasuredState());
data.put("MeasuredWidthAndState", v.getMeasuredWidthAndState());
data.put("SystemUiVisibility", v.getSystemUiVisibility());//11
data.put("VerticalScrollbarPosition", v.getVerticalScrollbarPosition());//11

相关文章

微信公众号

最新文章

更多

View类方法