Imagine you have a big linearlayout, let’s call it originalLayout that has a gestureDetector set to it.
Then you also inflate a ReLayNewsItem layout and put it into the originalLayout.
LayoutInflater inflater = (LayoutInflater)this.getSystemService(Context.LAYOUT_INFLATER_SERVICE);
RelativeLayout ReLayNewsItem = (RelativeLayout) inflater.inflate(R.layout.newsitem, null);
...
originalLayout.addView(ReLayNewsItem);
Now gestureDetector works only on the empty space of the originalLayout and does not work where I have the ReLayNewsItem.
What’s the best way to make ReLayNewsItem not obscure gesture?
P.S. I can not set the same gestureDetector onto ReLayNewsItem.
ReLayNewsItem.setClickable(false); – doesn’t work.
Whenever there is touch/gesture/motion event on the
ReLayNewsItem, let your layout consume it like returningmGesture.onTouchEvent(ReLayNewsItem_event)in your touch event method of ReLayNewsItem orlayout.dispatchTouchEvent(ReLayNewsItem_event).Read
Event Handlerpoint here:http://developer.android.com/guide/topics/ui/ui-events.html