Java Code Examples for android.widget.HorizontalScrollView#getChildAt()
The following examples show how to use
android.widget.HorizontalScrollView#getChildAt() .
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: CapturePictureUtils.java From DevUtils with Apache License 2.0 | 7 votes |
/** * 通过 HorizontalScrollView 绘制为 Bitmap * @param scrollView {@link HorizontalScrollView} * @param config {@link Bitmap.Config} * @return {@link Bitmap} */ public static Bitmap snapshotByHorizontalScrollView(final HorizontalScrollView scrollView, final Bitmap.Config config) { if (scrollView == null || config == null) return null; try { View view = scrollView.getChildAt(0); int width = view.getWidth(); int height = view.getHeight(); Bitmap bitmap = Bitmap.createBitmap(width, height, config); Canvas canvas = new Canvas(bitmap); canvas.drawColor(BACKGROUND_COLOR); scrollView.layout(0, 0, scrollView.getMeasuredWidth(), scrollView.getMeasuredHeight()); scrollView.draw(canvas); return bitmap; } catch (Exception e) { LogPrintUtils.eTag(TAG, e, "snapshotByHorizontalScrollView"); } return null; }