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

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

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

ScrollView.getChildCount介绍

暂无

代码示例

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

for (int i = 0; i < scrollView.getChildCount(); i++) {
  height += scrollView.getChildAt(i).getHeight();

代码示例来源:origin: aa112901/remusic

ScrollView scrollView = (ScrollView) mTarget;
View view = (View) scrollView
    .getChildAt(scrollView.getChildCount() - 1);
if (view != null) {
  int diff = (view.getBottom() - (scrollView.getHeight() + scrollView

代码示例来源:origin: nuptboyzhb/SuperSwipeRefreshLayout

ScrollView scrollView = (ScrollView) mTarget;
View view = (View) scrollView
    .getChildAt(scrollView.getChildCount() - 1);
if (view != null) {
  int diff = (view.getBottom() - (scrollView.getHeight() + scrollView

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

@Override
public int getRealChildCount() {
  if (realChildContainer != null) {
    return realChildContainer.getChildCount();
  } else {
    return super.getChildCount();
  }
}

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

ScrollView scrollView = (ScrollView) findViewById(R.id.scrollView);
for ( int i = 0; i < scrollView.getChildCount();  i++ ){
  View view = scrollView.getChildAt(i);
  view.setEnabled(false); 
}

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

ScrollView scroll = (ScrollView) findViewById(R.id.yourscrollid);
for ( int i = 0; i < scroll.getChildCount();  i++ ){
  View view = scroll.getChildAt(i);
  view.setEnabled(false); // Or whatever you want to do with the view.
}

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

@Override
protected void onFinishInflate() {
  super.onFinishInflate();
  if (super.getChildCount() > 0) {
    View rootView = getChildAt(0);
    if (rootView instanceof ViewGroup) {
      realChildContainer = (ViewGroup) rootView;
      menuLayoutList = new ArrayList<>(realChildContainer.getChildCount());
      for (int i = 0, len = realChildContainer.getChildCount(); i < len; i++) {
        View childView = realChildContainer.getChildAt(i);
        if (childView instanceof SwipeHorizontalMenuLayout) {
          menuLayoutList.add((SwipeHorizontalMenuLayout) childView);
        }
      }
    }
  }
}

代码示例来源:origin: Jhuster/JNote

public static Bitmap createBitmap(ScrollView v) {
  int width = 0, height = 0;
  for (int i = 0; i < v.getChildCount(); i++) {
    width += v.getChildAt(i).getWidth();
    height += v.getChildAt(i).getHeight();
  }
  Bitmap bitmap = Bitmap.createBitmap(width, height, Config.ARGB_8888);
  Canvas canvas = new Canvas(bitmap);
  v.draw(canvas);
  return bitmap;
}

代码示例来源:origin: lfkdsk/JustWeEngine

/**
 * 截取ScrollView
 *
 * @param v
 * @return
 */
public static Bitmap createBitmap(Context context, ScrollView v) {
  int width = 0, height = 0;
  for (int i = 0; i < v.getChildCount(); i++) {
    width += v.getChildAt(i).getWidth();
    height += v.getChildAt(i).getHeight();
  }
  if (width <= 0 || height <= 0) {
    return null;
  }
  int h = ((WindowManager) context.getSystemService(Context.WINDOW_SERVICE)).getDefaultDisplay().getHeight();
  if (height < h)
    height = h;
  Bitmap bitmap = Bitmap.createBitmap(width, height, Bitmap.Config.ARGB_8888);
  Canvas canvas = new Canvas(bitmap);
  v.draw(canvas);
  return bitmap;
}

代码示例来源:origin: youxin11544/RxJava_Simple

/**
   * 截取scrollview的屏幕
   *
   * @param scrollView
   * @return
   */
  public static Bitmap getBitmapByView(ScrollView scrollView) {
    int h = 0;
    Bitmap bitmap = null;
    // 获取scrollview实际高度
    for (int i = 0; i < scrollView.getChildCount(); i++) {
      h += scrollView.getChildAt(i).getHeight();
//            scrollView.getChildAt(i).setBackgroundColor(olor.parseColor("#ffffff"));
    }

    // 创建对应大小的bitmap
    bitmap = Bitmap.createBitmap(scrollView.getWidth(), h, Bitmap.Config.RGB_565);
    Canvas canvas = new Canvas(bitmap);
    scrollView.draw(canvas);

    return bitmap;
  }

代码示例来源:origin: luhaoaimama1/zone-sdk

/**
 * 截取scrollview的屏幕
 **/
public static Bitmap getBitmapByScrollView(ScrollView scrollView) {
  int h = 0;
  Bitmap bitmap = null;
  // 获取listView实际高度
  for (int i = 0; i < scrollView.getChildCount(); i++)
    h += scrollView.getChildAt(i).getHeight();
  Log.d(TAG, "实际高度:" + h);
  Log.d(TAG, " 高度:" + scrollView.getHeight());
  // 创建对应大小的bitmap
  bitmap = Bitmap.createBitmap(scrollView.getWidth(), h,
      Bitmap.Config.ARGB_8888);
  final Canvas canvas = new Canvas(bitmap);
  scrollView.draw(canvas);
  return bitmap;
}

代码示例来源:origin: 18Gray/CommonUtils

/**
 * ScrollView截屏
 * @param scrollView
 * @param activity
 * @param fileName
 * @return
 */
public static Bitmap screenShotScrollView(ScrollView scrollView, Activity activity, String fileName)
{
  int h = 0;
  Bitmap bitmap = null;
  // 获取scrollView实际高度
  for (int i = 0; i < scrollView.getChildCount(); i++)
  {
    h += scrollView.getChildAt(i).getHeight();
  }
  // 创建对应大小的bitmap
  bitmap = Bitmap.createBitmap(scrollView.getWidth(), h, Config.ARGB_8888);
  final Canvas canvas = new Canvas(bitmap);
  scrollView.draw(canvas);
  return bitmap;
}

代码示例来源:origin: Luolc/LiteSyllabusView

public static void saveScreenshot(Context context, ScrollView scrollView) {
  int height = 0;
  for (int i = 0; i < scrollView.getChildCount(); ++i) {
    height += scrollView.getChildAt(i).getHeight();
    scrollView.getChildAt(i).setBackgroundResource(R.drawable.mypku_bg);

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

Bitmap bitmap = null;
for (int i = 0; i < scrollView.getChildCount(); i++) {
  h += scrollView.getChildAt(i).getHeight();
  scrollView.getChildAt(i).setBackgroundResource(R.color.white);

代码示例来源:origin: wujingchao/MultiCardMenu

/**
 * Copy From ScrollView (API Level >= 14)
 * <p>The scroll range of a scroll view is the overall height of all of its
 * children.</p>
 */
private int computeVerticalScrollRange(ScrollView scrollView) {
  final int count = scrollView.getChildCount();
  final int contentHeight = scrollView.getHeight() - scrollView.getPaddingBottom() - scrollView.getPaddingTop();
  if (count == 0) {
    return contentHeight;
  }
  int scrollRange = scrollView.getChildAt(0).getBottom();
  final int scrollY = scrollView.getScrollY();
  final int overScrollBottom = Math.max(0, scrollRange - contentHeight);
  if (scrollY < 0) {
    scrollRange -= scrollY;
  } else if (scrollY > overScrollBottom) {
    scrollRange += scrollY - overScrollBottom;
  }
  return scrollRange;
}

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

Button btn = (Button)findViewById(R.id.button1);
btn.setOnClickListener(new OnClickListener() {
  @Override
  public void onClick(View arg0) {
    // create a new list
    ArrayList<Button> list = new ArrayList<Button>();
    ScrollView view = (ScrollView)findViewById(R.id.scrollView1);

    // add your clicked element on position 0
    list.add ( (Button) arg0 );

    for ( int i = 0; i < view.getChildCount(); i++ ) {
      if ( view.getChildAt(i) != arg0 ) {
        list.add( (Button) view.getChildAt(i));
      }
    }

    view.removeAllViews();

    for ( int x = 0; x < list.size(); x++ ) {
      view.addView(list.get(x));
      list.remove(x);
    }
  }
});

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

public void run() {
  ViewGroup relativeL = (ViewGroup) mScrollView
      .getChildAt(mScrollView.getChildCount() - 1);
  final int sVH = mScrollView.getBottom()
      - mScrollView.getTop();

代码示例来源:origin: imLibo/FilePicker

for (int i = 0; i < scrollView.getChildCount(); i++) {
  height += scrollView.getChildAt(i).getHeight();

代码示例来源:origin: roomanl/AndroidDownload

for (int i = 0; i < scrollView.getChildCount(); i++) {
  height += scrollView.getChildAt(i).getHeight();

代码示例来源:origin: wallabag/android-app

scrollViewLastChild = scrollView.getChildAt(scrollView.getChildCount() - 1);
webViewContent = (WebView)findViewById(R.id.webViewContent);
loadingPlaceholder = (TextView)findViewById(R.id.tv_loading_article);

相关文章

ScrollView类方法