i had tried a similar approach but it managed to get it to work. in
fact even defining the button in XML didnt work. i had put up a
message in this regard but got no response :(
the workaround was something like this - in the activity being
displayed, define the View (which has the canvas) and the button
separately. then use a ViewGroup container (i used a RelativeLayout)
and add the View and the Button as child views to this Container.
finally you use setContetView(myLayoutContainer) to display it all. u
can use the LayoutParams to position the button anywhere within the
container. its a simple matter to get a "handle" to the button
anywhere in your code so as to register the click events.
from what i gather, if you need to display two or more views (i.e. ur
View with the canvas and the Button) then it is necessary to use a
ViewGroup object such as LinearLayout, RelativeLayout etc.

hope that helps.



On May 15, 3:06 pm, Neha <nehathakka...@gmail.com> wrote:
> Hi,
>
> Can we create a button on a canvas without defining the button widget
> in the layout file. ie there is no layout .xml file defined for the
> application.
>
> Urgent help required please.
>
> Thanks and Regards,
> Neha
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google
Groups "Android Beginners" group.
To post to this group, send email to android-beginners@googlegroups.com
To unsubscribe from this group, send email to
android-beginners-unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/android-beginners?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to