سؤال

This is driving me crazy and I can't find any good resources to explain what I'm doing wrong. I want to draw some lines on my view that contains some other Android widgets. For example, I want to lay out some EditText, Buttons, etc in my xml and then draw some lines on the screen in relation to those EditText or Button widgets.

I've seen several examples that allow for regular drawing via Canvas, or SurfaceView but none show how I would integrate this with input controls such as EditText, buttons.

I tried this a couple of things that seem to be logical, but don't work. Am I going to have to roll my own subclass of SurfaceView or Canvas and skip using an .xml layout altogether or is there a way to set everything up via .xml without subclassing?? After hours pouring over Android Drawing tutorials, examples, and javadocs for Android, I've decided that I am clueless on how to even get started.

I really would prefer to keep the layout of the widgets and drawing surface in the .xml.

هل كانت مفيدة؟

المحلول

If you subclass one of the layout views, you should be able to use all the superclass's layout infrastructure and just do your own custom drawing.

مرخصة بموجب: CC-BY-SA مع الإسناد
لا تنتمي إلى StackOverflow
scroll top