Warning: file_get_contents(/data/phpspider/zhask/data//catemap/3/android/181.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
完成时Android拖放捕获屏幕_Android_Drag And Drop_Screenshot - Fatal编程技术网

完成时Android拖放捕获屏幕

完成时Android拖放捕获屏幕,android,drag-and-drop,screenshot,Android,Drag And Drop,Screenshot,我正在做一个Android应用程序,在这个程序中,用户可以拖放屏幕上的按钮,然后从手动设置中捕获图像并发送给我。我得到了拖放,我得到了图像上传,现在我只需要接收一个屏幕抓取的按钮重新定位从设备没有使用DDMs。这是我的主要活动 public class DragSymbols extends Activity { // Define the symbols and their initial coordinates in arrays. No limit in pri

我正在做一个Android应用程序,在这个程序中,用户可以拖放屏幕上的按钮,然后从手动设置中捕获图像并发送给我。我得到了拖放,我得到了图像上传,现在我只需要接收一个屏幕抓取的按钮重新定位从设备没有使用DDMs。这是我的主要活动

public class DragSymbols extends Activity {


            // Define the symbols and their initial coordinates in arrays. No limit in principle 
            // to how many. Coordinates are measured from the upper left corner of the screen, 
            // with x increasing to the right and y increasing downward



            float [] X = {2, 2, 2, 2, 2, };   // Initial x coord in pixels of upper left corner of symbol
            float [] Y = {2, 2, 2, 2, 2, };     // Initial y coord in pixels of upper left corner of symbol

            // The Drawable corresponding to the symbol. R.drawable.file refers to file.png, .jpg, 
            // or .gif stored in res/drawable-hdpi (referenced from code without the extension).


            // 5 Buttons in Total
            int[]symbolIndex = {R.drawable.twit,R.drawable.twit, R.drawable.twit,R.drawable.twit,R.drawable.twit,};

            // Instantiate a SymbolDragger instance (which subclasses View), passing to it in the
            // constructor the context (this) and the above arrays.  Then set the content view to 
            // this instance of SymbolDragger (so the layout is being specified entirely by SymbolDragger, 
            // with no XML layout file).  The resulting view should then place draggable symbols with 
            // content and initial position defined by the above arrays on the screen.

            SymbolDragger view = new SymbolDragger(this, X, Y, symbolIndex);
            view.setLayoutParams(new ViewGroup.LayoutParams(ViewGroup.LayoutParams.FILL_PARENT,
                ViewGroup.LayoutParams.FILL_PARENT));
            setContentView(view);
        }
    }

据我所知,您希望在拖放完成后拍摄应用程序的屏幕截图。为此,你可以通过以下链接,这可以重定向到正确的方向你


希望这能有所帮助。

我知道它就在那里,我只是不记得在哪里看到过它,多亏了一百万Devaok,我已经尝试在上面的代码中实现了4种不同的方式拍摄屏幕快照,项目是干净的,拖放项正在显示,但我的主布局不是。。。有什么线索吗?或者我如何捕捉屏幕截图。。。可能运行一个后台线程??:0