Hi, your custom view should derives from a Viewgroup. (Viewgroup inherit from View) Then simply create the View you want to add and call Viewgroup.addView().
Regards. On 12 mai, 18:32, Kapil <kapilsc...@gmail.com> wrote: > Dear Developers, > > My name is Kapil and I am trying to write a custom view which inherits > View class and everything is drawn in the onDraw function. There is no > xml for the view. The custom view class is instantiated and set in the > function setContentView of an activity. > > I wish to add the some buttons to the custom view class > programatically; I have searched over forums and internet; but could > not find proper solution. > > Is it possible to do? Can we add a button [or any other view item] > dynamically to a custom view without using XML? > > Also Is mixing of custom drawing and XML based view content possible > and if yes how to achieve it? > > Please advise. > > regards > Kapil -- You received this message because you are subscribed to the Google Groups "Android Developers" group. To post to this group, send email to android-developers@googlegroups.com To unsubscribe from this group, send email to android-developers+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/android-developers?hl=en