Make sure your view calls setFocusableOnTouchEvents(true) On Apr 16, 4:44 am, a a <[email protected]> wrote: > Dear all, i tested below, but it don't work > > 1. I wrote my GodsendView > public class GodsendView extends View implements OnTouchListener > { > @Override > public boolean onTouch(View v, MotionEvent event) { > Log.d("harvey", "onTouch"); > return false; > } > > } > > 2.wrote a xml > <?xml version="1.0" encoding="utf-8"?> > <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" > android:orientation="vertical" > android:layout_width="fill_parent" > android:layout_height="fill_parent" > > > <com.android.godsend.GodsendView > android:id="@+id/godsend" > android:layout_width="fill_parent" > android:layout_height="fill_parent" > tileSize="24" > /> > </LinearLayout> > > 3. Activity > public class GodSendActivity extends Activity { > /** Called when the activity is first created. */ > @Override > public void onCreate(Bundle savedInstanceState) { > super.onCreate(savedInstanceState); > setContentView(R.layout.main); > } > > } > > but after i touch the screen, can't print my test log > Log.d("harvey", "onTouch"); > > -- > You received this message because you are subscribed to the Google > Groups "Android Developers" group. > To post to this group, send email to [email protected] > To unsubscribe from this group, send email to > [email protected] > For more options, visit this group > athttp://groups.google.com/group/android-developers?hl=en
-- You received this message because you are subscribed to the Google Groups "Android Developers" group. To post to this group, send email to [email protected] To unsubscribe from this group, send email to [email protected] For more options, visit this group at http://groups.google.com/group/android-developers?hl=en

