[android-developers] Re: Why drawing in View.onDraw not take effect, but does in ViewGroup.dispatchDraw
Got it! Thank you! On 3月31日, 下午11时35分, Romain Guy wrote: > For efficiency, layouts do not get their onDraw() method called. To > enable it, call setWillNotDrawEnabled(false) (or set the equivalent > XML attribute to false.) > > > > On Tue, Mar 31, 2009 at 7:15 AM, FBear wrote: > > > HI buddies, > > > I'm trying to create a custom widget which looks lick HTML table. > > I chose to derive from TableLayout, which is the subclass of ViewGroup > > and View. > > > What's confusing me is that the drawing I put into my override of > > View.onDraw did not take effect, until I moved the codes to the > > override of ViewGroup.dispatchDraw. > > > I know dispatchDraw is a good place to draw something, but I'm just > > wondering why there's such difference in my practice? > > > Thank you in advance. > > > FBear > > -- > Romain Guy > Android framework engineer > romain...@android.com > > Note: please don't send private questions to me, as I don't have time > to provide private support. All such questions should be posted on > public forums, where I and others can see and answer them --~--~-~--~~~---~--~~ 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 -~--~~~~--~~--~--~---
[android-developers] Re: Why drawing in View.onDraw not take effect, but does in ViewGroup.dispatchDraw
For efficiency, layouts do not get their onDraw() method called. To enable it, call setWillNotDrawEnabled(false) (or set the equivalent XML attribute to false.) On Tue, Mar 31, 2009 at 7:15 AM, FBear wrote: > > HI buddies, > > I'm trying to create a custom widget which looks lick HTML table. > I chose to derive from TableLayout, which is the subclass of ViewGroup > and View. > > What's confusing me is that the drawing I put into my override of > View.onDraw did not take effect, until I moved the codes to the > override of ViewGroup.dispatchDraw. > > I know dispatchDraw is a good place to draw something, but I'm just > wondering why there's such difference in my practice? > > Thank you in advance. > > FBear > > > -- Romain Guy Android framework engineer romain...@android.com Note: please don't send private questions to me, as I don't have time to provide private support. All such questions should be posted on public forums, where I and others can see and answer them --~--~-~--~~~---~--~~ 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 -~--~~~~--~~--~--~---