OnTouchListener doesn't work with relative layout
android, java
Solution
tv.setClickable(true);
is causing layout, not to fire touch event. Tried removing this.
Problem
I have a `RelativeLayout` in which I am adding many `TextViews` dynamically. The problem I am facing is, whenever I apply an onTouch listener to `TextViews` individually, it detects touches but when i add touch to my relative layout, it never responds. This code detects touch events just fine: ``` TextView tv = new TextView(this); tv.setText(values[i]); Drawable d = getResources().getDrawable(R.drawable.level_small_corners); tv.setClickable(true); tv.setId(i+1); tv.setTextSize(18); tv.setOnTouchListener(cellTouch); ``` But when I add all these TextViews in myRelativeLayout: ``` myRelativeLayout.setOnTouchListener(cellTouch); ``` Now, the onTouchListener never gets called. Why is that so? ``` <?xml version="1.0" encoding="utf-8"?> <RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android" android:layout_width="fill_parent" android:layout_height="fill_parent" android:background="@android:color/black"> . . . <ScrollView android:layout_width="fill_parent" android:layout_height="wrap_content" android:layout_below="@+id/levelFirstLayout" android:layout_marginBottom="70dp" > <RelativeLayou android:id="@+id/wordsRelativeLayout" android:layout_width="fill_parent" android:layout_height="wrap_content" android:clickable="true" android:focusable="true" android:focusableInTouchMode="true" > </RelativeLayout> </ScrollView> . . . </RelativeLayout> ```