Handling Click event

Put problem concerning Views, Layouts and other XML-Resources (like AndroidManifest) here.

Handling Click event

Postby MKay » Sun Aug 30, 2009 12:54 pm

Hi,

yesterday i read the tutorial about scrolling a picture: scrolling_a_picture_horizontally_and_vertically-t3245.html

I used this snipped to create my own scrollable Layout, which works wonderful :-)
Inside this layout i have some of my own View-Objects.
I want to handle clicks/taps on these views inside the scrolled area.
But if i add an onClick-Listener to the View, the scrolling will not work (Same with GestureDetector in the View).

I think this is the result of the onTouch-Method in the View which returns true.

But how can i solve this problem?

Best regards,
MKay
MKay
Freshman
Freshman
 
Posts: 3
Joined: Sat Aug 29, 2009 2:14 pm

Top

Postby Frink » Mon Sep 07, 2009 8:56 am

Have you tried making the onTouchEvent return false?

If you return a true value, Android won't process it any further.
User avatar
Frink
Developer
Developer
 
Posts: 46
Joined: Sat Aug 15, 2009 7:42 pm

Postby MKay » Mon Sep 07, 2009 10:55 am

Thx for your reply.

The problem is the following:
My ScrollerView contains several Boxes (my views). Now i want to recognize clicks on these Boxes via OnClickListener. Therefore onTouchEvent has to return true. Otherwise the OnClickListener will not be fired.
But this will interrupt the scroll-feature.
If onTouchEvent returns false, the scrolling works, but the onclick not.

Best regards,
MKay
MKay
Freshman
Freshman
 
Posts: 3
Joined: Sat Aug 29, 2009 2:14 pm

Postby sudheer1437 » Mon Sep 14, 2009 10:36 am

I think scroll view doesnt take touches...
I am not sure...
juz check it out...
sudheer1437
Experienced Developer
Experienced Developer
 
Posts: 79
Joined: Sat Aug 08, 2009 7:42 am
Location: India

Postby MKay » Mon Sep 14, 2009 11:03 am

Scroll View can scroll only in one direction (horizontally or vertically) at the same time.
The Scroll Layout i implemented can scroll diagonally.
MKay
Freshman
Freshman
 
Posts: 3
Joined: Sat Aug 29, 2009 2:14 pm

Top

Return to View, Layout & Resource Problems

Who is online

Users browsing this forum: No registered users and 7 guests