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

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

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

ScrollView.setLayoutParams介绍

暂无

代码示例

代码示例来源: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: ACRA/acra

final ScrollView root = new ScrollView(this);
root.setPadding(PADDING, PADDING, PADDING, PADDING);
root.setLayoutParams(new LayoutParams(LayoutParams.MATCH_PARENT, LayoutParams.MATCH_PARENT));
root.setFocusable(true);
root.setFocusableInTouchMode(true);

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

ScrollView scroll = new ScrollView(context);
scroll.setBackgroundColor(android.R.color.transparent);
scroll.setLayoutParams(new LayoutParams(LayoutParams.FILL_PARENT,
                       LayoutParams.FILL_PARENT));
scroll.addView(yourTableView);

代码示例来源:origin: jrvansuita/MaterialAbout

private void init(AboutBuilder bundle) {
  layoutInflater = LayoutInflater.from(getContext());
  ViewGroup holder = this;
  ViewGroup.LayoutParams lp = new ViewGroup.LayoutParams(ViewGroup.LayoutParams.MATCH_PARENT, ViewGroup.LayoutParams.WRAP_CONTENT);
  if (bundle.isWrapScrollView()) {
    lp = new ViewGroup.LayoutParams(ViewGroup.LayoutParams.MATCH_PARENT, ViewGroup.LayoutParams.MATCH_PARENT);
    ScrollView scrollView = new ScrollView(getContext());
    scrollView.setLayoutParams(lp);
    addView(scrollView);
    holder = new FrameLayout(getContext());
    holder.setLayoutParams(lp);
    scrollView.addView(holder);
  }
  setLayoutParams(lp);
  layoutInflater.inflate(R.layout.xab_about_layout_card, holder);
}

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

sliderLayout.setLayoutParams(params);

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

ScrollView sv = new ScrollView(this);
ScrollView.LayoutParams lp2 = new ScrollView.LayoutParams(
  LayoutParams.FILL_PARENT, LayoutParams.FILL_PARENT);
sv.setLayoutParams(lp2);
yourTable.addView(sv);

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

ScrollView scrollView = new ScrollView(context);
       scrollView.setLayoutParams(new LinearLayout.LayoutParams(ViewGroup.LayoutParams.MATCH_PARENT, ViewGroup.LayoutParams.MATCH_PARENT));
       TextView textView = new TextView(context);
       textView.setText("my text");
       LinearLayout linearLayout = new LinearLayout(context);
       linearLayout.setOrientation(LinearLayout.VERTICAL);
       linearLayout.setGravity(Gravity.RIGHT);
       linearLayout.addView(textView);
       scrollView.addView(linearLayout);

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

ScrollView scroll = new ScrollView(this);
scroll.setLayoutParams(new LayoutParams(LayoutParams.FILL_PARENT,
   LayoutParams.FILL_PARENT));

LinearLayout layout=new LinearLayout(this);
layout.setOrientation(LinearLayout.VERTICAL);
layout.setLayoutParams(new LayoutParams(LayoutParams.WRAP_CONTENT,
   LayoutParams.WRAP_CONTENT)); 

scroll.addView(layout,
   new LayoutParams(LayoutParams.FILL_PARENT, LayoutParams.WRAP_CONTENT));

setContentView(scroll);

代码示例来源: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: 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: 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: 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: 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: 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: stackoverflow.com

ScrollView scroll = new ScrollView(context);
scroll.setBackgroundColor(android.R.color.transparent);
scroll.setLayoutParams(new LayoutParams(LayoutParams.FILL_PARENT,
                       LayoutParams.FILL_PARENT));
scroll.addView(yourLinearLayout);

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

aboutTextView.setLayoutParams(new ScrollView.LayoutParams(
      LayoutParams.FILL_PARENT, LayoutParams.WRAP_CONTENT));
ScrollView scroll = new ScrollView(this);
int scrollPadding = getResources().getDimensionPixelSize(R.dimen.scroll_padding);
scroll.setPadding(scrollPadding, scrollPadding, scrollPadding, scrollPadding);
scroll.setLayoutParams(new RelativeLayout.LayoutParams(LayoutParams.FILL_PARENT,
      LayoutParams.FILL_PARENT));
scroll.addView(aboutTextView);
RelativeLayout fragmentContainer = (RelativeLayout) findViewById(R.id.fragmentContainer);
  fragmentContainer;
fragmentContainer.addView(scroll);

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

//Create the ScrollView
ScrollView scroll = new ScrollView(this);
scroll.setBackgroundColor(android.R.color.transparent);
scroll.setLayoutParams(new LayoutParams(LayoutParams.FILL_PARENT,
                       LayoutParams.FILL_PARENT));

//Get the base layout for your Activity and add the scroll view to it.
ViewGroup root = (ViewGroup)findViewById(R.id.content);
root.addView(scroll);

//Add your layout here which contains the EditText, Spinner and RadioButton and CheckBox.
scroll.addView(yourExistingLayout);

代码示例来源: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();
      }

相关文章

ScrollView类方法