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

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

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

ScrollView.addView介绍

暂无

代码示例

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

ScrollView scroller = new ScrollView(this);
TextView tv=(TextView)findViewById(R.id.textView1);
scroller.addView(tv);

代码示例来源:origin: Bearded-Hen/Android-Bootstrap

@Override protected void onCreate(Bundle savedInstanceState) {
  super.onCreate(savedInstanceState);
  setContentView(R.layout.activity_base);
  ScrollView scrollView = (ScrollView) findViewById(R.id.scrollView);
  if (scrollView != null) {
    scrollView.addView(LayoutInflater.from(this).inflate(getContentLayoutId(), scrollView, false));
  }
  ButterKnife.bind(this);
}

代码示例来源:origin: gzu-liyujiang/AndroidPicker

@NonNull
@Override
protected ScrollView makeCenterView() {
  ScrollView scrollView = new ScrollView(activity);
  layout = new LinearLayout(activity);
  layout.setOrientation(LinearLayout.VERTICAL);
  for (String item : items) {
    LinearLayout line = new LinearLayout(activity);
    line.setOrientation(LinearLayout.HORIZONTAL);
    line.setGravity(Gravity.CENTER);
    TextView textView = new TextView(activity);
    LinearLayout.LayoutParams lp = new LinearLayout.LayoutParams(0, WRAP_CONTENT, 1.0f);
    lp.gravity = Gravity.CENTER;
    textView.setLayoutParams(lp);
    textView.setText(item);
    textView.setGravity(Gravity.CENTER);
    line.addView(textView);
    CheckBox checkBox = new CheckBox(activity);
    checkBox.setLayoutParams(new LinearLayout.LayoutParams(0, WRAP_CONTENT, 0.4f));
    line.addView(checkBox);
    layout.addView(line);
  }
  scrollView.addView(layout);
  return scrollView;
}

代码示例来源:origin: novoda/android-demos

@Override
  public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
    if (container == null) {
      return null;
    }

    ScrollView scroller = new ScrollView(getActivity());
    TextView text = new TextView(getActivity());
    int padding = (int)TypedValue.applyDimension(TypedValue.COMPLEX_UNIT_DIP, 4, getActivity().getResources().getDisplayMetrics());
    text.setPadding(padding, padding, padding, padding);
    scroller.addView(text);
    text.setText(Constants.DETAILS[getArguments().getInt("index", 0)]);
    return scroller;
  }
}

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

svContent.addView(llContent, new ScrollView.LayoutParams(LayoutParams.MATCH_PARENT, LayoutParams.WRAP_CONTENT));

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

svContent.addView(llContent, new ScrollView.LayoutParams(LayoutParams.MATCH_PARENT, LayoutParams.WRAP_CONTENT));

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

svContent.addView(llContent, new ScrollView.LayoutParams(LayoutParams.MATCH_PARENT, LayoutParams.WRAP_CONTENT));

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

svContent.addView(llContent, new ScrollView.LayoutParams(LayoutParams.MATCH_PARENT, LayoutParams.WRAP_CONTENT));

代码示例来源:origin: Bearded-Hen/Android-Bootstrap

scrollView.addView(dropdownView);

代码示例来源:origin: ACRA/acra

root.setFocusable(true);
root.setFocusableInTouchMode(true);
root.addView(scrollable);

代码示例来源:origin: firebase/firebase-jobdispatcher-android

private View createViewForJob(JobParameters job) {
 TableLayout tableLayout = new TableLayout(this);
 addRow(tableLayout, "TAG = " + job.getTag());
 addRow(tableLayout, "SERVICE = " + job.getService());
 if (job.getTriggerReason() != null
   && job.getTrigger() instanceof JobTrigger.ContentUriTrigger) {
  ContentUriTrigger trigger = (ContentUriTrigger) job.getTrigger();
  addRow(tableLayout, "OBSERVED URIs = ");
  for (ObservedUri uri : trigger.getUris()) {
   addRow(
     tableLayout,
     "URI = " + uri.getUri() + ", flags = " + Integer.toBinaryString(uri.getFlags()));
  }
  addRow(tableLayout, "TRIGGERED URIs = ");
  for (Uri uri : job.getTriggerReason().getTriggeredContentUris()) {
   addRow(tableLayout, uri.toString());
  }
 }
 ScrollView scrollView = new ScrollView(this);
 scrollView.addView(tableLayout);
 return scrollView;
}

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

scrollView.addView(list);

代码示例来源:origin: tianshaojie/AndroidFine

@Override
public void handleStyledAttributes(TypedArray a) {
  mRootContainer = new LinearLayout(getContext());
  mRootContainer.setOrientation(LinearLayout.VERTICAL);
  mHeaderContainer = new FrameLayout(getContext());
  if (mZoomView != null) {
    mHeaderContainer.addView(mZoomView);
  }
  if (mHeaderView != null) {
    mHeaderContainer.addView(mHeaderView);
  }
  int contentViewResId = a.getResourceId(R.styleable.PullToZoomView_contentView, 0);
  if (contentViewResId > 0) {
    LayoutInflater mLayoutInflater = LayoutInflater.from(getContext());
    mContentView = mLayoutInflater.inflate(contentViewResId, null, false);
  }
  mRootContainer.addView(mHeaderContainer);
  if (mContentView != null) {
    mRootContainer.addView(mContentView);
  }
  mRootContainer.setClipChildren(false);
  mHeaderContainer.setClipChildren(false);
  mRootView.addView(mRootContainer);
}

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

mTextView.setText("");
mScrollView = new ScrollView(this);
mScrollView.addView(mTextView);
setContentView(mScrollView);

代码示例来源:origin: ukanth/afwall

mTextView.setText("");
mScrollView = new ScrollView(this);
mScrollView.addView(mTextView);
setContentView(mScrollView);

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

oncreate()
{
  ScrollView sv=(ScrollView)findViewById(R.id.scrollView1);
  TextView tv=new TextView(this);
  tv.setText("just keep the text what you want here");
  sv.addView(tv);

}

代码示例来源:origin: ukanth/afwall

mTextView.setText("");
mScrollView = new ScrollView(this);
mScrollView.addView(mTextView);
setContentView(mScrollView);

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

// Find the ScrollView 
ScrollView scrollView = (ScrollView) findViewById(R.id.scrollView1);

// Create a LinearLayout element
LinearLayout linearLayout = new LinearLayout(this);
linearLayout.setOrientation(LinearLayout.VERTICAL);

// Add Buttons
Button button = new Button(this);
button.setText("Some text");
linearLayout.addView(button);

// Add the LinearLayout element to the ScrollView
scrollView.addView(linearLayout);

相关文章

ScrollView类方法