Touch Event on a TableLayout

fbs419fbs419 USMember ✭✭

In my .axml I have a TableLayout inside a ScrollView inside a RelativeLayout:

        <RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
            stuff
            <ScrollView xmlns:android="http://schemas.android.com/apk/res/android"
                stuff
                <MyCustomTableLayout  xmlns:android="http://schemas.android.com/apk/res/android"
                    android:id="@+id/MyId"
                stuff

I want to do something if the user hits the whole table, not individual cells. I create MyCustomTableLayout which inherits from TableLayout and which overrides both OnTouchEvent and OnInterceptTouchEvent. I access it by:

MyCustomTableLayout myTL = FindViewById<MyCustomTableLayout> (Resource.Id.MyId);

The constructor for the class gets called, but no matter where I touch, OnTouchEvent and OnInterceptTouchEvent never get called. What else do I have to do to get these methods called?

Tagged:

Posts

  • fbs419fbs419 USMember ✭✭

    Well -- by doing myTL.OnInterceptTouchEvent(e), the methods get called, but only if a cell in the table is selected. [ e is just declared as a local MotionEvent.] What I want is to be to click anywhere in the TableLayout and have the method get called. Anybody have any ideas?

Sign In or Register to comment.