Center fixed text during canvas scroll in Android
Question
I am trying to create a watermark text to my custom view, but the problem is when I scroll the canvas, I am unable to determine the exact co-ordinates of the screen's center. I tried tracking the onTouchEvent and getting the co-ordinates, but still it is not smooth, it appears on touching the screen during scroll and not always centered. Is there any way to keep a drawtext out of the scroll?
Solution
You can use a framelayout which has to layers. The base one will be the view which scrolls and the top layer will be the textview that has a gravity center. In that case the textview will not be scroll when the base view is scrolled.
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow