Pregunta

Problem: I have a custom Calendar view that I generated using canvas drawing and stuff. This is the layout for Fragment A. I have another Fragment B which when the user does something in Fragment A is instantiated and replaces Fragment A via getSupportFragmentManager().beginTransaction().replace(R.id.fragment_container), fragmentB).addToBackStack().commit(); works fine up to this point (Fragment B is shown). Now when I press the back button, I expect Fragment B to exit or be removed from the screen, to be replaced by the previous fragment A. still works correctly - however the now displayed Calendar view is all messed up and sh*t, all the drawings are stacked up on the left side of the screen and does not look like a calendar at all. Why is this happening, and how should I go about this?

¿Fue útil?

Solución

i found the culprit - the cell width measurement inside my custom canvas is being set to zero for some particular reason - inside onMeasure. i moved the assignment statement inside onDraw and it worked perfectly.

Licenciado bajo: CC-BY-SA con atribución
No afiliado a StackOverflow
scroll top