i have a huge problem managing my horizontal scrollview. It haves inside a horizontal linear layout with a lot of vertical linear layouts wich haves a text and a image.
I want that when the user press on the vertical linearlayouts, the ontouchlistener must be called launching a new feature of my app. The problem is that when the user scrolls the scrollview, the ontouchlistener of the verticallinearlayouts is being called, and i dont want that. How can this be solved? Thanks My code: final HorizontalScrollView hsv = new HorizontalScrollView(this); RelativeLayout.LayoutParams hsvParams = new RelativeLayout.LayoutParams(LayoutParams.FILL_PARENT, LayoutParams.WRAP_CONTENT); hsvParams.addRule(RelativeLayout.BELOW,6); hsv.setBackgroundColor(0x55383838); hsv.setLayoutParams(hsvParams); hsv.setVisibility(View.GONE); //inicialmente está oculto LinearLayout hsvll = new LinearLayout(this); hsvll.setOrientation(LinearLayout.HORIZONTAL); hsvll.setLayoutParams(new LayoutParams(LayoutParams.WRAP_CONTENT, LayoutParams.WRAP_CONTENT)); hsvll.setPadding(0, 0, 0, 5); createThumbnails(); List <LinearLayout> thumbnailLinearLayouts = new ArrayList<LinearLayout>(); for (int i=1; i<=squareGLSurfaceView.pages.size();i++){ //el tope es <=pages.size() porque hay que recordar que se ha añadido una página en blanco al principio, por lo que la última página será = .size(). Nos guiamos por pages.size en lugar de thumbnails.size() porque thumbnails.size() puede haber crecido para añadir una página en blanco al final, que no queremos mostrar LinearLayout ll = new LinearLayout(this); ll.setOrientation(LinearLayout.VERTICAL); ll.setLayoutParams(new LayoutParams(LayoutParams.WRAP_CONTENT, LayoutParams.WRAP_CONTENT)); ll.setPadding(10, 0, 10, 0); thumbnailLinearLayouts.add(ll); TextView tv = new TextView(this); tv.setText(""+(i)); tv.setGravity(Gravity.RIGHT); ll.addView(tv); ImageView iv = new ImageView(this); iv.setImageBitmap(thumbnails.get(i)); ll.addView(iv); hsvll.addView(ll); } hsv.addView(hsvll); rl.addView(hsv); for (int i=0;i<thumbnailLinearLayouts.size();i++){ final int auxIndex=i; thumbnailLinearLayouts.get(i).setOnTouchListener(new OnTouchListener(){ @Override public boolean onTouch(View v, MotionEvent event) { MagazineStatus.currentPage=auxIndex; hsv.setVisibility(View.GONE); return true; } }); } -- You received this message because you are subscribed to the Google Groups "Android Developers" group. To post to this group, send email to android-developers@googlegroups.com To unsubscribe from this group, send email to android-developers+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/android-developers?hl=en