Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

Some links on this page are affiliate links: if you buy through them we may earn a commission, at no extra cost to you.

To capture an Android ScrollView beyond its visible viewport, wait until layout is complete, get its single direct content child, and draw that child onto a software Bitmap-backed Canvas. Drawing the child captures its full laid-out content height; drawing the ScrollView itself ordinarily gives you the viewport, not the entire scrollable document.

Capture the full ScrollView content

A ScrollView has one direct child that holds its scrollable content. After layout, that child has the width and height to capture. Allocate a bitmap at those dimensions, then call draw on the child with a canvas backed by the bitmap.

fun captureFullScrollView(scrollView: ScrollView, onReady: (Bitmap) -> Unit) {
    scrollView.post {
        require(scrollView.childCount == 1) {
            "ScrollView must have one direct child"
        }

        val content = scrollView.getChildAt(0)
        val width = content.width
        val height = content.height
        require(width > 0 && height > 0) {
            "Scroll content is not laid out"
        }

        val bitmap = Bitmap.createBitmap(
            width,
            height,
            Bitmap.Config.ARGB_8888
        )
        val canvas = Canvas(bitmap)
        content.draw(canvas)
        onReady(bitmap)
    }
}

Add these Android imports if they are not already present:

Free tools Windows power users keep installed

One-click scans. No signup required.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.
import android.graphics.Bitmap
import android.graphics.Canvas
import android.widget.ScrollView

post queues the capture work on the view so it runs after the view has had an opportunity to complete layout. The dimension checks turn two common silent failures—capturing before layout and allocating a zero-sized bitmap—into clear errors. The callback receives the bitmap; decide there or in your caller whether to display it, encode it, or save it.

#1 Best Overall
Samsung Galaxy A17 5G Smart Phone 128GB US 1 Yr Manufacturer Warranty Black
  • YOUR CONTENT, SUPER SMOOTH: The ultra-clear 6.7" FHD+ Super AMOLED display of Galaxy A17 5G helps bring your content to life, whether you're scrolling through recipes or video chatting with loved ones.¹
  • LIVE FAST. CHARGE FASTER: Focus more on the moment and less on your battery percentage with Galaxy A17 5G. Super Fast Charging powers up your battery so you can get back to life sooner.²
  • MEMORIES MADE PICTURE PERFECT: Capture every angle in stunning clarity, from wide family photos to close-ups of friends, with the triple-lens camera on Galaxy A17 5G.
  • NEED MORE STORAGE? WE HAVE YOU COVERED: With an improved 2TB of expandable storage, Galaxy A17 5G makes it easy to keep cherished photos, videos and important files readily accessible whenever you need them.³
  • BUILT TO LAST: With an improved IP54 rating, Galaxy A17 5G is even more durable than before.⁴ It’s built to resist splashes and dust and comes with a stronger yet slimmer Gorilla Glass Victus front and Glass Fiber Reinforced Polymer back.

Android’s ScrollView API documentation says the view must have completed a full layout before draw(Canvas) is called. The method above uses the content child’s laid-out dimensions and draws that child, rather than asking the viewport to somehow expand to its full scroll range.

Choose the right bounds and background

The example assumes the child’s drawing origin is (0, 0) and that its width and height represent the area you want. If the child’s drawing bounds do not start at the bitmap’s origin, use the measured bounds and translate the canvas so content lands at the correct pixel position:

val bounds = content.measuredWidth to content.measuredHeight
val bitmap = Bitmap.createBitmap(bounds.first, bounds.second, Bitmap.Config.ARGB_8888)
val canvas = Canvas(bitmap)
canvas.translate(-content.left.toFloat(), -content.top.toFloat())
content.draw(canvas)

Use this translation only when those offsets are meaningful for your view hierarchy; otherwise, drawing at the origin is appropriate. Check the resulting bounds and alignment with the actual layout, especially if custom child views or transforms are involved.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

A new bitmap does not automatically inherit the ScrollView’s background. If the content itself does not paint every pixel, transparent areas remain transparent. If the output needs an opaque page color, paint that color onto the canvas before drawing the child. For example:

Rank #2
Tracfone Motorola Moto G 2025, 64GB, Saphire Blue (Locked to
  • Carrier: This phone is locked to Tracfone, which means this device can only be used on the Tracfone wireless network. Tracfone plan required, activating is easy, just 3 steps.
  • DISPLAY: Immersive viewing on a 6.7-inch super-bright 120Hz display with powerful stereo speakers and Bass Boost for cinematic entertainment.
  • CAMERA SYSTEM: Advanced 50MP Quad Pixel camera captures sharp, detailed photos and videos in any lighting condition
  • PERFORMANCE: Lightning-fast 5G connectivity paired with a powerful processor and RAM Boost for smooth multitasking.
  • BATTERY LIFE: Long-lasting 5000mAh battery with TurboPower charging technology delivers hours of power in minutes.
val canvas = Canvas(bitmap)
canvas.drawColor(Color.WHITE)
content.draw(canvas)

Import android.graphics.Color when using that example. If the desired result includes the ScrollView’s padding, scrollbar, or a viewport-shaped frame, compose those elements separately. Drawing only the content child is intentional: it captures the full document area, not the surrounding viewport decoration.

Why drawing the child works

Bitmap.createBitmap creates a pixel buffer, and Canvas(bitmap) makes that bitmap the drawing target. Calling content.draw(canvas) asks the laid-out view and its descendants to render into that target. Because the bitmap uses the child’s full width and height, the result can include content currently off-screen in the ScrollView.

This is a software-rendered snapshot path. Android’s View documentation recommends creating a Canvas from a Bitmap or Picture and calling draw(Canvas) for software snapshots. Use a mutable software configuration such as ARGB_8888 here; a Config.HARDWARE bitmap is immutable and expensive to read back on the CPU.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

Do not use getDrawingCache() for new code. The drawing cache approach is obsolete/deprecated; an explicitly allocated bitmap and canvas make both the capture dimensions and rendering target clear. Android also cautions that software rendering may not reproduce hardware-only rendering features exactly, so this technique is not a guarantee of pixel-identical output for every custom view or effect.

Rank #3
Samsung Galaxy A17 5G Smart Phone 128GB, US 1 Yr Manufacturer Warranty Blue
  • YOUR CONTENT, SUPER SMOOTH: The ultra-clear 6.7" FHD+ Super AMOLED display of Galaxy A17 5G helps bring your content to life, whether you're scrolling through recipes or video chatting with loved ones.¹
  • LIVE FAST. CHARGE FASTER: Focus more on the moment and less on your battery percentage with Galaxy A17 5G. Super Fast Charging powers up your battery so you can get back to life sooner.²
  • MEMORIES MADE PICTURE PERFECT: Capture every angle in stunning clarity, from wide family photos to close-ups of friends, with the triple-lens camera on Galaxy A17 5G.
  • NEED MORE STORAGE? WE HAVE YOU COVERED: With an improved 2TB of expandable storage, Galaxy A17 5G makes it easy to keep cherished photos, videos and important files readily accessible whenever you need them.³
  • BUILT TO LAST: With an improved IP54 rating, Galaxy A17 5G is even more durable than before.⁴ It’s built to resist splashes and dust and comes with a stronger yet slimmer Gorilla Glass Victus front and Glass Fiber Reinforced Polymer back.

When PixelCopy is the better choice

PixelCopy serves a different purpose: it copies visible pixels from a window or Surface. It is useful for a screenshot of what is currently shown on screen, including UI feedback or testing use cases. It does not render an arbitrary off-screen portion of a long child merely because that child belongs to a ScrollView.

Approach What it captures Use it when
Draw the ScrollView’s content child to a software Bitmap The full laid-out child, including off-screen content You need the complete scrollable document as an image
PixelCopy Visible window or Surface pixels You need a screenshot of the displayed viewport or Surface

If the actual requirement is the visible window, use a window-level capture approach such as PixelCopy rather than building a full-document bitmap. If the requirement is the entire off-screen document, render the laid-out content child.

Manage large captures safely

A bitmap stores pixels for every requested coordinate. Its allocation grows with width multiplied by height, so a very tall ScrollView can demand substantial memory even if only a small slice is visible at once. ARGB_8888 uses four bytes per pixel for its pixel data; a 1,000 by 10,000 pixel bitmap therefore represents about 40 MB of pixel storage, before other app memory and allocation overhead. Treat the bitmap dimensions as a resource limit, not just a visual setting.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.
  • Check content dimensions before allocation and reject or route unexpectedly large captures.
  • Avoid retaining the bitmap alongside duplicate full-size copies. Release references when the image is no longer needed.
  • Move compression and file I/O off the UI thread. The view draw itself may also be costly for a complex hierarchy, so consider how long the capture blocks the interface.
  • If a single bitmap is too large, render vertical tiles and combine them or export the tiles as pages. Ensure the view is drawn with the correct vertical offset for each tile.

Splitting work into tiles limits the size of each temporary bitmap, but does not automatically reduce memory if the final result is assembled into one equally large bitmap. If the final output must remain a single image, its total pixel storage is still required. Exporting separate tiles or pages avoids that final full-size allocation.

Rank #4
Samsung Galaxy S26 Ultra, Unlocked Android Smartphone, 512GB, Black
  • PRIVACY DISPLAY: Automatically hide your screen from those beside you. The built-in privacy display can be preset¹ to turn on when receiving notifications, typing passwords, or using specific apps
  • TYPE IT IN. TRANSFORM IT FAST: Enhance any shot in seconds on your smartphone by using Photo Assist² with Galaxy AI.³ Add objects, restore details, or apply new styles by simply typing or tapping
  • NIGHTS, CAPTURED CLEARLY: From gigs to city lights, record and capture moments after dark with clarity using Nightography so your photos and videos stay crisp and clear on your Samsung Galaxy
  • MAKE IT. EDIT IT. SHARE IT: Turn everyday moments into something personal with creative tools built right into your mobile phone, whether it’s a special contact photo, custom wallpaper, an invitation or more⁴
  • HELP THAT KEEPS UP: Stay in the moment while Now Nudge with Galaxy AI helps you respond faster and stay organized with smart suggestions⁵ that appear exactly when you need them on your phone

Account for software-rendering differences

Some views rely on hardware-only effects or behavior that differs in a software canvas. Hardware-only effects, real-time shadows, outline clipping, and custom drawing operations can be rendered differently or not as expected in a software bitmap. Inspect the result on the views and Android configurations that matter to your app rather than assuming every on-screen effect transfers identically.

  • If the full document is essential, isolate the affected view or provide a software-compatible drawing path.
  • If the visual requirement is specifically the currently visible hardware-rendered window, capture that window with PixelCopy instead.
  • If only some effects differ, decide whether to adjust the software rendering path or accept that the bitmap is a document rendering rather than a pixel-for-pixel window screenshot.
Independent reader supportYour contribution helps us test, update, and keep practical guides available for everyone.Support on Ko-Fi

Troubleshooting common failures

The bitmap contains only the visible viewport

Check what you call draw on. Drawing the ScrollView renders its viewport-sized view; draw its direct content child into a bitmap sized to the child’s full laid-out width and height to include off-screen content.

The capture is blank, clipped, or zero-sized

The capture may be running before layout has finished, or the child may not yet have valid dimensions. Schedule the work after layout, as in the example, and verify that both width and height are greater than zero. If clipping remains, compare the bitmap bounds with the child’s actual drawing bounds and account for any nonzero origin.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

The ScrollView has no direct child or multiple direct children

A ScrollView’s content model expects one direct child. Put the desired collection of views inside one container and use that container as the ScrollView’s direct child. The sample deliberately checks the child count rather than silently capturing the wrong view.

Best Value
Tracfone Moto g Play 2024 Prepaid Phone with a 1-Yr Plan Included
  • Carrier: This phone is locked to Tracfone, which means this device can only be used on the Tracfone wireless network. Activating is easy, just 3 steps.
  • ACTIVATION Promotion: Includes 1500 min, 1500 texts & 1500 MB Data + add more as you need it
  • CAMERA SYSTEM: 50MP Quad Pixel camera. Capture sharper, more vibrant photos day or night with 4x the light sensitivity.
  • PERFORMANCE: Blazing-fast Qualcomm performance. Get the speed you need for great entertainment with a Snapdragon 680 processor and 4GB of RAM.
  • 64GB built-in storage. Get plenty of room for photos, movies, songs, and apps. Made for US

The output has transparent areas or the wrong frame

The bitmap begins transparent, and drawing the content child does not add the ScrollView’s background, padding, scrollbar, or viewport frame. Paint a background first if required, and draw or compose any frame elements separately.

Effects look different from the screen

The child is being rendered to a software canvas, which can differ from hardware rendering for shadows, clipping, and custom effects. Use a software-compatible view path for a full-document capture, or PixelCopy if the requested output is the visible window rather than off-screen content.

Allocation fails or the app becomes sluggish

Inspect the requested pixel dimensions and reduce the capture scope, render tiles or pages, and avoid holding extra copies. Keep compression and file writes off the UI thread. A tiled workflow helps with intermediate allocations; it cannot remove the memory cost of a final bitmap that has the same full dimensions.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

Or skip the browser setup

ScreenshotNeo is a website screenshot API, not an Android view-rendering API: it captures a web URL, so it cannot render an in-app ScrollView that exists only inside your Android process. If the content is available as a webpage and a browser screenshot is what you need, one GET request can return an image or PDF. The API accepts cleanup options for cookie banners, newsletter popups, and chat widgets; its response identifies page verdict and billing status, and bot checks, blank pages, timeouts, failed loads, and cache hits are not billed. Its MCP server gives AI agents screenshot tools, and the free plan includes 1,000 shots per month without a card; paid plans start at $5 for 3,000 shots. See the ScreenshotNeo API documentation.

curl -G "https://api.screenshotneo.com/v1/shot" -d access_key=YOUR_API_KEY --data-urlencode url=https://stripe.com -o shot.webp

For the native Android ScrollView implementation, use the bitmap-backed Canvas method above. For a webpage screenshot, ScreenshotNeo is the distinct web-capture option. Sign up free for 1,000 screenshots a month with no card.

Frequently Asked Questions

Can I save the resulting bitmap as a PNG?

Yes. The capture function returns a Bitmap; encode it in the format your app needs, using a suitable output stream and handling the I/O away from the UI thread.

Does this capture work if the ScrollView is not attached to a window?

The example relies on the view’s normal post-layout lifecycle. An unattached or otherwise unmeasured view may not have useful dimensions; ensure it has been measured and laid out before capturing.

What’s actually slowing this PC down?

Pick the symptom - the matching free tool is one click away.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

Product prices and availability are accurate as of the date/time indicated and are subject to change. Any price and availability information displayed on Amazon at the time of purchase will apply.