Quiero llegar al final, el botón derecho cambiará de color, cuando llegue al comienzo, el botón izquierdo cambiará de color, entonces, quiero preguntar cómo detectarlo HorizontalScrollView ha llegado a su fin.Cómo detectar que el HorizontalScrollView ha llegado a su fin
6
A
Respuesta
12
maxScrollX = horizontalScrollView.getChildAt(0).getMeasuredWidth()-horizontalScrollView.getMeasuredWidth();
if (horizontalScrollView.getScrollX() == 0) {
lImageView.setImageResource(R.drawable.left_green);
} else {
lImageView.setImageResource(R.drawable.left);
}
if (horizontalScrollView.getScrollX() == maxScrollX) {
rImageView.setImageResource(R.drawable.right_green);
} else {
rImageView.setImageResource(R.drawable.right);
}
+2
donde desencadenar este evento, ¿acaso algún oyente lo tiene? – NarendraJi
Cuestiones relacionadas
- 1. Cómo detectar que una ventana ha agotado su llamada "ShowDialog"
- 2. Cómo detectar si el usuario ha llegado casi al final de la página usando jQuery?
- 3. ¿Cómo puedo saber cuándo ha llegado el último OutputDataReceived?
- 4. HorizontalScrollView con flechas
- 5. ¿Hay alguna forma de detectar cuándo ha llegado a la última observación en un paso de SAS DATA?
- 6. Android - Detectar Fin de Presión Larga
- 7. ¿Puede un servidor http detectar que un cliente ha cancelado su solicitud?
- 8. cómo detectar cuándo ha finalizado MotionEvent.ACTION_MOVE
- 9. ¿Cómo detectar el país y la ciudad de un usuario que accede a su sitio?
- 10. ¿Cómo saber si un enumerador ha llegado al final de la colección en C#?
- 11. Android: Autoscrolling HorizontalScrollView
- 12. fillviewport de horizontalscrollview desactiva el desplazamiento?
- 13. ¿Cómo detectar si una variable ha cambiado?
- 14. ¿Cómo ha usado IContainer/ISite/IComponent en su propio código?
- 15. ¿Puedo detectar que un método ha sido anulado?
- 16. Detectar si el usuario ha usado el botón Atrás
- 17. Cómo detectar el tipo de navegador y su versión
- 18. Detectar si NSDate contiene un día de fin de semana
- 19. detectar si UITableView ha desplazado hasta la parte inferior
- 20. ¿Cómo detectar si una notificación ha sido descartada?
- 21. Cómo desplazarse mediante programación un HorizontalScrollView
- 22. Cómo detectar si un usuario ha cerrado sesión, en php?
- 23. Detectar qué AnimationEnd se ha activado a través de animationName
- 24. Javascript: detectar cuando la página ha sido navegada "atrás" a
- 25. Socket IO detectar cuando el cliente ha perdido la conexión
- 26. Detectar si el contenido del iframe se ha cargado satisfactoriamente
- 27. Menú horizontal con HorizontalScrollView-android
- 28. ¿Cómo detectar cuando un UIView ha cambiado de tamaño?
- 29. Cómo detectar si un elemento en mi ObservableCollection ha cambiado
- 30. Cómo detectar el idioma de un usuario a través de su dirección IP
Este enlace le ayudará a: [http://stackoverflow.com/questions/2089552/android-how-to-detect-when-a-scroll-has-ended][1] [1]: http://stackoverflow.com/questions/2089552/android-how-to-detect-when-a-scroll-has-ended –
[este post podría ayudarle a] (http: //stackoverflow.com/a/3952629/593709) –
maxScrollX = horizontalScrollView.getChildAt (0) \t \t .getMeasured Ancho() - horizontalScrollView.getMeasuredWidth(); si (horizontalScrollView.getScrollX() == 0) { \t \t \t \t \t lImageView.setImageResource (R.drawable.left_green); \t \t \t \t} else { \t \t \t \t \t lImageView.setImageResource (R.drawable.left); \t \t \t \t} \t \t \t \t si (horizontalScrollView.getScrollX() == maxScrollX) { \t \t \t \t \t rImageView.setImageResource (R.drawable.right_green); \t \t \t \t} else { \t \t \t \t \t rImageView.setImageResource (R.drawable.right); \t \t \t \t} – jack