安卓拖放捕获屏幕完成
问题描述:
我正在做一个Android应用程序,用户将能够在屏幕上拖放按钮,然后从那里捕获该图像并将其发送给我。我得到了拖放,我得到了图片上传,现在我只需要从设备上获取重新定位按钮的屏幕截图,而无需使用DDM。这里是我的MainActivity安卓拖放捕获屏幕完成
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);
}
}
答
从我能理解你想采取一旦你的应用程序的屏幕截图拖放完成。对于这个U可以去throgh以下链接可重定向你在正确的方向
http://coderzheaven.com/2011/10/how-to-take-screenshot-of-your-phone-in-android-through-code/
http://coderzheaven.com/2011/10/how-to-create-screenshot-of-application-and-store-it-in-sdcard/
希望这有助于。
我知道是在那里,我只是不记得我在哪里看到它,谢谢百万德瓦 – KaSiris 2012-02-15 07:38:20
好吧我已经试图实现上述代码的4种不同方式的拍摄屏幕截图,项目是干净的,拖放项目正在显示,但我的主要布局不是......任何线索为什么?或者我如何捕获屏幕截图...也许运行后台线程? :0 – KaSiris 2012-02-15 08:20:46
从昨天开始尝试......没有任何工作。 – KaSiris 2012-02-16 09:09:01