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

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

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

ScrollView.<init>介绍

暂无

代码示例

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

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

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

private void initBody(RelativeLayout rlBody, float ratio) {
  svContent = new ScrollView(activity);
  rlBody.addView(svContent, new RelativeLayout.LayoutParams(LayoutParams.MATCH_PARENT, LayoutParams.WRAP_CONTENT));

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

private void initBody(RelativeLayout rlBody, float ratio) {
  svContent = new ScrollView(activity);
  rlBody.addView(svContent, new RelativeLayout.LayoutParams(LayoutParams.MATCH_PARENT, LayoutParams.WRAP_CONTENT));

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

private void initBody(RelativeLayout rlBody, float ratio) {
  svContent = new ScrollView(activity);
  rlBody.addView(svContent, new RelativeLayout.LayoutParams(LayoutParams.MATCH_PARENT, LayoutParams.WRAP_CONTENT));

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

private void initBody(RelativeLayout rlBody, float ratio) {
  svContent = new ScrollView(activity);
  rlBody.addView(svContent, new RelativeLayout.LayoutParams(LayoutParams.MATCH_PARENT, LayoutParams.WRAP_CONTENT));

代码示例来源:origin: k9mail/k-9

final ScrollView scrollView = new ScrollView(activity);

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

private ScrollView createDropDownView() {
  final LinearLayout dropdownView = new LinearLayout(getContext());
  ScrollView scrollView = new ScrollView(getContext());
  int clickableChildCounter = 0;

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

@NonNull
protected View buildCustomView(@Nullable Bundle savedInstanceState) {
  final ScrollView root = new ScrollView(this);
  root.setPadding(PADDING, PADDING, PADDING, PADDING);
  root.setLayoutParams(new LayoutParams(LayoutParams.MATCH_PARENT, LayoutParams.MATCH_PARENT));

代码示例来源:origin: robolectric/robolectric

@Test
public void shouldSmoothScrollTo() throws Exception {
 ScrollView scrollView = new ScrollView(ApplicationProvider.getApplicationContext());
 scrollView.smoothScrollTo(7, 6);
 assertEquals(7, scrollView.getScrollX());
 assertEquals(6, scrollView.getScrollY());
}

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

@Test
 public void shouldSmoothScrollBy() throws Exception {
  ScrollView scrollView = new ScrollView(ApplicationProvider.getApplicationContext());
  scrollView.smoothScrollTo(7, 6);
  scrollView.smoothScrollBy(10, 20);

  assertEquals(17, scrollView.getScrollX());
  assertEquals(26, scrollView.getScrollY());
 }
}

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

@Override
protected ScrollView createRefreshableView(Context context, AttributeSet attrs) {
  ScrollView scrollView;
  if (VERSION.SDK_INT >= VERSION_CODES.GINGERBREAD) {
    scrollView = new InternalScrollViewSDK9(context, attrs);
  } else {
    scrollView = new ScrollView(context, attrs);
  }
  scrollView.setId(R.id.scrollview);
  return scrollView;
}

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

list.setOrientation(LinearLayout.VERTICAL);
ScrollView scrollView = new ScrollView(this) {
  Rect mRect = new Rect();

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

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

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

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

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

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

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

@Override
protected ScrollView createRefreshableView(Context context, AttributeSet attrs) {
  ScrollView scrollView;
  if (VERSION.SDK_INT >= VERSION_CODES.GINGERBREAD) {
    scrollView = new InternalScrollViewSDK9(context, attrs);
  } else {
    scrollView = new ScrollView(context, attrs);
  }
  scrollView.setId(R.id.scrollview);
  return scrollView;
}

相关文章

ScrollView类方法