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

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

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

ScrollView.draw介绍

暂无

代码示例

代码示例来源:origin: seven332/EhViewer

@Override
  public void draw(@NonNull Canvas canvas) {
    super.draw(canvas);

    final int restoreCount = canvas.save();
    canvas.translate(getScrollX(), getScrollY());

    // Draw top indicator
    if (needShowTopIndicator()) {
      fillTopIndicatorDrawRect();
      canvas.drawRect(mTemp, mPaint);
    }
    // Draw bottom indicator
    if (needShowBottomIndicator()) {
      fillBottomIndicatorDrawRect();
      canvas.drawRect(mTemp, mPaint);
    }

    canvas.restoreToCount(restoreCount);
  }
}

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

@Override
public void draw(Canvas canvas) {
  super.draw(canvas);
  int width = getWidth();
  int height = getHeight();
  if (mInsets != null && mInsetForeground != null) {
    int sc = canvas.save();
    canvas.translate(getScrollX(), getScrollY());
    // Top
    mTempRect.set(0, 0, width, mInsets.top);
    mInsetForeground.setBounds(mTempRect);
    mInsetForeground.draw(canvas);
    // Bottom
    mTempRect.set(0, height - mInsets.bottom, width, height);
    mInsetForeground.setBounds(mTempRect);
    mInsetForeground.draw(canvas);
    // Left
    mTempRect
        .set(0, mInsets.top, mInsets.left, height - mInsets.bottom);
    mInsetForeground.setBounds(mTempRect);
    mInsetForeground.draw(canvas);
    // Right
    mTempRect.set(width - mInsets.right, mInsets.top, width, height
        - mInsets.bottom);
    mInsetForeground.setBounds(mTempRect);
    mInsetForeground.draw(canvas);
    canvas.restoreToCount(sc);
  }
}

代码示例来源:origin: trezor/trezor-android

@Override
public void draw(Canvas canvas) {
  super.draw(canvas);
  int width = getWidth();
  int height = getHeight();
  if (mInsets != null && mInsetForeground != null) {
    int sc = canvas.save();
    canvas.translate(getScrollX(), getScrollY());
    // Top
    mTempRect.set(0, 0, width, mInsets.top);
    mInsetForeground.setBounds(mTempRect);
    mInsetForeground.draw(canvas);
    // Bottom
    mTempRect.set(0, height - mInsets.bottom, width, height);
    mInsetForeground.setBounds(mTempRect);
    mInsetForeground.draw(canvas);
    // Left
    mTempRect.set(0, mInsets.top, mInsets.left, height - mInsets.bottom);
    mInsetForeground.setBounds(mTempRect);
    mInsetForeground.draw(canvas);
    // Right
    mTempRect.set(width - mInsets.right, mInsets.top, width, height - mInsets.bottom);
    mInsetForeground.setBounds(mTempRect);
    mInsetForeground.draw(canvas);
    canvas.restoreToCount(sc);
  }
}

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

Bitmap bitmap = Bitmap.createBitmap(scrollView.getWidth(), height, Bitmap.Config.ARGB_8888);
Canvas canvas = new Canvas(bitmap);
scrollView.draw(canvas);

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

Bitmap.Config.ARGB_8888);
final Canvas canvas = new Canvas(bitmap);
scrollView.draw(canvas);
FileOutputStream out = null;
try {

相关文章

ScrollView类方法