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

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

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

ScrollView.getLayoutParams介绍

暂无

代码示例

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

/** 动态适配编辑界面的高度 */
public void run() {
  int height = svContent.getChildAt(0).getHeight();
  RelativeLayout.LayoutParams lp = ResHelper.forceCast(svContent.getLayoutParams());
  if (height > maxBodyHeight && lp.height != maxBodyHeight) {
    lp.height = maxBodyHeight;
    svContent.setLayoutParams(lp);
  } else if (height < maxBodyHeight && lp.height == maxBodyHeight) {
    lp.height = LayoutParams.WRAP_CONTENT;
    svContent.setLayoutParams(lp);
  }
}

代码示例来源:origin: jaydenxiao2016/AndroidFire

/** 动态适配编辑界面的高度 */
public void run() {
  int height = svContent.getChildAt(0).getHeight();
  RelativeLayout.LayoutParams lp = R.forceCast(svContent.getLayoutParams());
  if (height > maxBodyHeight && lp.height != maxBodyHeight) {
    lp.height = maxBodyHeight;
    svContent.setLayoutParams(lp);
  } else if (height < maxBodyHeight && lp.height == maxBodyHeight) {
    lp.height = LayoutParams.WRAP_CONTENT;
    svContent.setLayoutParams(lp);
  }
}

代码示例来源:origin: palaima/DebugDrawer

DrawerLayout.LayoutParams params = (DrawerLayout.LayoutParams) sliderLayout.getLayoutParams();
if (params != null) {

代码示例来源:origin: huangweicai/OkLibDemo

public void onAnimationUpdate(ValueAnimator animation) {
    Integer value = (Integer) animation.getAnimatedValue();
    mConsoleContainer.getLayoutParams().height = value.intValue();
    mConsoleContainer.requestLayout();
  }
});

代码示例来源:origin: andforce/iBeebo

@Override
public void onKeyBoardShow(int height) {
  if (isSmileClicked) {
    RelativeLayout.LayoutParams params = (RelativeLayout.LayoutParams) mEditPicScrollView.getLayoutParams();
    params.height = RelativeLayout.LayoutParams.MATCH_PARENT;
    mEditPicScrollView.requestLayout();
  }
}

代码示例来源:origin: hiphonezhu/Android-Demos

@Override
  public void onViewPositionChanged(View changedView, int left, int top, int dx, int dy) {
    super.onViewPositionChanged(changedView, left, top, dx, dy);
    // 改变底部区域高度
    LinearLayout.LayoutParams bottomViewLayoutParams = (LinearLayout.LayoutParams)bottomView.getLayoutParams();
    bottomViewLayoutParams.height = bottomViewLayoutParams.height + dy * -1;
    bottomView.setLayoutParams(bottomViewLayoutParams);
    // 改变顶部区域高度
    LinearLayout.LayoutParams topViewLayoutParams = (LinearLayout.LayoutParams)topView.getLayoutParams();
    topViewLayoutParams.height = topViewLayoutParams.height + dy;
    topView.setLayoutParams(topViewLayoutParams);
  }
});

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

View bodyLayout = (View)m_dialog.findViewById(R.id.my_item);
ScrollView scroller = (ScrollView)m_dialog.findViewById(R.id.my_scroll);
ViewGroup topLayout =  (ViewGroup)scroller.getParent();
ViewGroup.LayoutParams params = scroller.getLayoutParams();
int index = topLayout.indexOfChild(scroller);
scroller.removeAllViews();
topLayout.removeView(scroller);
topLayout.addView(bodyLayout, index, params);

代码示例来源:origin: wutq/AndroidModuleDemo

/**
 * 设置底部弹出带条目的ScrollView的高度
 *
 * @param size 条目数量
 */
private void setItemScrollViewHeight(int size) {
  // 添加条目过多的时候控制高度
  if (size >= 7) {
    LinearLayout.LayoutParams params = (LinearLayout.LayoutParams) sLayoutContent.getLayoutParams();
    params.height = PxUtils.getScreenHeight(mContext) / 2;
    sLayoutContent.setLayoutParams(params);
  }
}

代码示例来源:origin: BROUDING/SimpleDialog

private void setCustomView(View customView) {
  if( builder.textContent != null ) {
    throw new IllegalStateException("setCustomView - You cannot use it when you have content");
  } else if( builder.showProgress ) {
    throw new IllegalStateException("setCustomView - You cannot use it when you want progress SimpleDialog");
  }
  ScrollView mScollView = (ScrollView) transitionsContainer.findViewById(R.id.layout_custom);
  customView.measure(View.MeasureSpec.makeMeasureSpec(0, View.MeasureSpec.UNSPECIFIED), View.MeasureSpec.makeMeasureSpec(0, View.MeasureSpec.UNSPECIFIED));
  transitionsContainer.measure(View.MeasureSpec.makeMeasureSpec(0, View.MeasureSpec.UNSPECIFIED), View.MeasureSpec.makeMeasureSpec(0, View.MeasureSpec.UNSPECIFIED));
  WindowManager windowManager;
  windowManager   = (WindowManager) builder.context.getSystemService(Context.WINDOW_SERVICE);
  Display display = windowManager.getDefaultDisplay();
  Point displaySize = new Point();
  display.getSize(displaySize);
  LinearLayout.LayoutParams params = (LinearLayout.LayoutParams) mScollView.getLayoutParams();
  params.width  = LinearLayout.LayoutParams.MATCH_PARENT;
  params.height = LinearLayout.LayoutParams.WRAP_CONTENT;
  int DECENT_HEIGHT = 300;
  int prettyHeight  = displaySize.y -transitionsContainer.getMeasuredHeight() -DECENT_HEIGHT;    // DECENT_HEIGHT is just for looks of the view
  if( customView.getMeasuredHeight() > prettyHeight ) {
    params.height = prettyHeight;
    if( builder.textTitle != null ) {
      params.height = prettyHeight -50;
    }
  }
  mScollView.setLayoutParams( params );
  mScollView.addView( customView );
}

代码示例来源:origin: yoyiyi/bilisoleil

/** 动态适配编辑界面的高度 */
public void run() {
  int height = svContent.getChildAt(0).getHeight();
  RelativeLayout.LayoutParams lp = ResHelper.forceCast(svContent.getLayoutParams());
  if (height > maxBodyHeight && lp.height != maxBodyHeight) {
    lp.height = maxBodyHeight;
    svContent.setLayoutParams(lp);
  } else if (height < maxBodyHeight && lp.height == maxBodyHeight) {
    lp.height = LayoutParams.WRAP_CONTENT;
    svContent.setLayoutParams(lp);
  }
}

代码示例来源:origin: andforce/iBeebo

@Override
      public void onAnimationEnd(Animation animation) {
//                RelativeLayout.LayoutParams params = new RelativeLayout.LayoutParams(ViewGroup.LayoutParams.MATCH_PARENT, ViewGroup.LayoutParams.MATCH_PARENT);
        RelativeLayout.LayoutParams params = (RelativeLayout.LayoutParams) mEditPicScrollView.getLayoutParams();
        params.height = RelativeLayout.LayoutParams.MATCH_PARENT;
        mEditPicScrollView.setLayoutParams(params);
        mSmileyPicker.setVisibility(View.GONE);
        mSmileyPicker.requestLayout();
      }

代码示例来源:origin: myxh/CoolShopping

/** 动态适配编辑界面的高度 */
public void run() {
  int height = svContent.getChildAt(0).getHeight();
  RelativeLayout.LayoutParams lp = R.forceCast(svContent.getLayoutParams());
  if (height > maxBodyHeight && lp.height != maxBodyHeight) {
    lp.height = maxBodyHeight;
    svContent.setLayoutParams(lp);
  } else if (height < maxBodyHeight && lp.height == maxBodyHeight) {
    lp.height = LayoutParams.WRAP_CONTENT;
    svContent.setLayoutParams(lp);
  }
}

代码示例来源:origin: mingjunli/GithubApp

/** 动态适配编辑界面的高度 */
public void run() {
  int height = svContent.getChildAt(0).getHeight();
  RelativeLayout.LayoutParams lp = R.forceCast(svContent.getLayoutParams());
  if (height > maxBodyHeight && lp.height != maxBodyHeight) {
    lp.height = maxBodyHeight;
    svContent.setLayoutParams(lp);
  } else if (height < maxBodyHeight && lp.height == maxBodyHeight) {
    lp.height = LayoutParams.WRAP_CONTENT;
    svContent.setLayoutParams(lp);
  }
}

代码示例来源:origin: 6ag/BaoKanAndroid

/** 动态适配编辑界面的高度 */
public void run() {
  int height = svContent.getChildAt(0).getHeight();
  RelativeLayout.LayoutParams lp = ResHelper.forceCast(svContent.getLayoutParams());
  if (height > maxBodyHeight && lp.height != maxBodyHeight) {
    lp.height = maxBodyHeight;
    svContent.setLayoutParams(lp);
  } else if (height < maxBodyHeight && lp.height == maxBodyHeight) {
    lp.height = LayoutParams.WRAP_CONTENT;
    svContent.setLayoutParams(lp);
  }
}

代码示例来源:origin: 736008081/frameAndroid

/** 动态适配编辑界面的高度 */
public void run() {
  int height = svContent.getChildAt(0).getHeight();
  RelativeLayout.LayoutParams lp = com.mob.tools.utils.R.forceCast(svContent.getLayoutParams());
  if (height > maxBodyHeight && lp.height != maxBodyHeight) {
    lp.height = maxBodyHeight;
    svContent.setLayoutParams(lp);
  } else if (height < maxBodyHeight && lp.height == maxBodyHeight) {
    lp.height = LayoutParams.WRAP_CONTENT;
    svContent.setLayoutParams(lp);
  }
}

代码示例来源:origin: yiwent/Mobike

/** 动态适配编辑界面的高度 */
public void run() {
  int height = svContent.getChildAt(0).getHeight();
  RelativeLayout.LayoutParams lp = R.forceCast(svContent.getLayoutParams());
  if (height > maxBodyHeight && lp.height != maxBodyHeight) {
    lp.height = maxBodyHeight;
    svContent.setLayoutParams(lp);
  } else if (height < maxBodyHeight && lp.height == maxBodyHeight) {
    lp.height = LayoutParams.WRAP_CONTENT;
    svContent.setLayoutParams(lp);
  }
}

代码示例来源:origin: gaolhjy/enjoyshop

/** 动态适配编辑界面的高度 */
public void run() {
  int height = svContent.getChildAt(0).getHeight();
  RelativeLayout.LayoutParams lp = ResHelper.forceCast(svContent.getLayoutParams());
  if (height > maxBodyHeight && lp.height != maxBodyHeight) {
    lp.height = maxBodyHeight;
    svContent.setLayoutParams(lp);
  } else if (height < maxBodyHeight && lp.height == maxBodyHeight) {
    lp.height = LayoutParams.WRAP_CONTENT;
    svContent.setLayoutParams(lp);
  }
}

代码示例来源:origin: AndroidHensen/YaNi

/** 动态适配编辑界面的高度 */
public void run() {
  int height = svContent.getChildAt(0).getHeight();
  RelativeLayout.LayoutParams lp = R.forceCast(svContent.getLayoutParams());
  if (height > maxBodyHeight && lp.height != maxBodyHeight) {
    lp.height = maxBodyHeight;
    svContent.setLayoutParams(lp);
  } else if (height < maxBodyHeight && lp.height == maxBodyHeight) {
    lp.height = LayoutParams.WRAP_CONTENT;
    svContent.setLayoutParams(lp);
  }
}

代码示例来源:origin: thinkingsim/NewsZero

/** 动态适配编辑界面的高度 */
public void run() {
  int height = svContent.getChildAt(0).getHeight();
  RelativeLayout.LayoutParams lp = ResHelper.forceCast(svContent.getLayoutParams());
  if (height > maxBodyHeight && lp.height != maxBodyHeight) {
    lp.height = maxBodyHeight;
    svContent.setLayoutParams(lp);
  } else if (height < maxBodyHeight && lp.height == maxBodyHeight) {
    lp.height = LayoutParams.WRAP_CONTENT;
    svContent.setLayoutParams(lp);
  }
}

代码示例来源:origin: Calsign/APDE

public void initCodeAreaAndConsoleDimensions() {
  ScrollView console = getConsoleScroller();
  
  // Initialize in case we have the layout weights instead of actual values
  codePager.getLayoutParams().height = codePager.getHeight();
  console.getLayoutParams().height = console.getHeight();
}

相关文章

ScrollView类方法