Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
如何为 Bitmap 设置 onTouchListener。例如
pongball = BitmapFactory.decodeResource(getResources(), R.drawable.pongball);
将位图对象包装到视图中,例如ImageView:
ImageView
imageView.setImageBitmap(pongball);
然后将触摸侦听器设置为 ImageView:
imageView.setOnTouchListener(new OnTouchListener() { @Override public boolean onTouch(View arg0, MotionEvent arg1) { return false; } });