android-pixel-copy

Using PixelCopy to copy a scaled View within a DialogFragment

独自空忆成欢 提交于 2021-01-29 05:33:47
问题 I have a DialogFragment that creates an AlertDialog with a custom view in onCreateDialog . The custom view includes a spinning progress bar and a prompt as well as a large view (larger than screen dimensions) that is fit inside the custom content via scaleX and scaleY values. I am using the PixelCopy API to copy only the large view into a bitmap. This works well, but with a rather annoying caveat: I call PixelCopy as such: val winloc = intArrayOf(0, 0) view.getLocationOnScreen(winloc) val