Android:如何选择图像的一部分?
答
使用BitMap概念。将完整图像转换为位图,裁剪基于(x,y)位置的位图。
Bitmap bitmap=BitmapFactory.decodeResource(getResources(), R.drawable.myimage);
Bitmap cropbitmap=Bitmap.createBitmap(bitmap, xpoint,ypoint,width, height);
//default android method createBitmap(Bitmap source, int x, int y, int width, int height)
等简单的方式利用图书馆这样从GitHub
答
我想你可以使用getLocationOnScreen()
并硬编码你想要的值。如果用户点击图片的某个部分,会提示一个响应,如果他们点击其他地方,则会提示另一个响应。更多信息Android: How do I get the x y coordinates within an image/ImageView?