0

I have 3 Relative Layouts(A,B and C) and parent of all these layouts is same(which is also a Relative Layout). Layout 'A' has fill_parent to its parent and other two(B and C) are on the first layout(Layout 'A').'B' aligned to top and 'C' aligned to bottom relative to 'A'. So when I touch on layout 'B' or 'C' the touchListener of Layout 'A' gets called.

So how to remove touchListener of layout 'A' when user tap on the 'B' or 'C'. I mean to say nothing happened when user tap on 'B' or 'C'

4

3 回答 3

0

你可以试试这个;

        relativeLayoutA.bringToFront();
        relativeLayoutB.bringToFront();
于 2013-09-16T07:14:20.990 回答
0

那么当用户点击'B'或'C'时如何删除布局'A'的touchListener。我的意思是说当用户点击“B”或“C”时没有发生任何事情

在 B 和 C 的 onClick 事件中,你可以这样做:

layoutA.setOnTouchListener(null); // if you have set the touch listener as you mentioned in above quote.

如果您设置了 onClickListener,请执行以下操作:

 layoutA.setOnClickListener(null);
于 2013-09-16T06:48:11.347 回答
0

回答我自己的问题是:

B.setClickable(true);
C.setClickable(true);
于 2013-09-16T08:16:07.333 回答