我不得不采取了以后可以保存在SD卡上的截图。我已经通过在下面给出链接的code消失了。
I had to take a screenshot that can be later saved in SD card. I have gone through the code given at below this link.
通过code 的Android抓图
Android take screenshot via code
的问题是,它会在我的SD卡零(0)kb的文件。可能是什么问题?什么是 id.layoutroot
?
problem is that it creates a zero(0) kb file in my Sd card. what could be the problem? and what is id.layoutroot
?
layoutroot是最有可能给根布局的ID在
layoutroot is most likely the id given to the root layout as in
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout
xmlns:android="http://schemas.android.com/apk/res/android"
android:id="@+id/layoutroot"
android:layout_width="wrap_content"
android:layout_height="wrap_content">
...
... (other ui items)
尝试用你想捕捉并检查绘图启用缓存视图的ID。
Try to use the id of the view you want to capture and check if the drawing cache is enabled.