android - Custom onDraw() method not called -


  & lt; linearLayout एंड्रॉइड: id = "@ + id / svLL" एंड्रॉइड: अभिविन्यास = "क्षैतिज" एंड्रॉइड: Layout_width = "fill_parent" एंड्रॉइड: layout_height = "fill_parent" & gt; & Lt; ScrollView एंड्रॉइड: एंड्रॉइड: एंड्रॉइड: layout_width = "wrap_content" एंड्रॉइड: layout_height = "wrap_content" xmlns: एंड्रॉइड = "http://schemas.android.com/apk/res/android" & gt; ; & Lt;! - & lt; TextView एंड्रॉइड: layout_width = "match_parent" एंड्रॉइड: layout_height = "wrap_content" android: text = "@ string / scrollbar_2_text" / & gt; - & gt; & Lt; com.mypackage.MyDrawableView एंड्रॉइड: layout_width = "fill_parent" एंड्रॉइड: layout_height = "wrap_content" / & gt; & Lt; / scrollview & gt; & Lt; / LinearLayout & gt;  

  सार्वजनिक वर्ग MyDrawableView विस्तार देता है देखें {संदर्भ इस संदर्भ <; सार्वजनिक MyDrawableView (संदर्भ संदर्भ, AttributeSet attr) {सुपर (संदर्भ); ThisContext = संदर्भ; } @ ओवरराइड संरक्षित शून्य पर डरा (कैनवास कैनवास) {सुपर। डॉन (कैनवास); अंतिम पेंट पेंट = नया पेंट (); paint.setColor (Color.BLUE); paint.setTextSize (12); Canvas.drawText ("ब्लाह ब्लाह", 0, 100, पेंट); }}  

  सार्वजनिक वर्ग MyActivity गतिविधि को बढ़ाता है {// आपके सदस्य चर घोषणा यहाँ // जब गतिविधि पहली बार बनाई गई है कहा जाता है @ क्रिएट पर सार्वजनिक शून्य (बंडल सहेजे गए इन्स्टेंसस्टेट) को ओवरराइड करें {// आपका कोड यहां सुपर। परम (सहेजे गए इन्स्टेंसस्टेट); setContentView (R.layout.xmllayout); LinearLayout svll = (LinearLayout) findViewById (R.id.svlL); Svll.setLayoutParams (नई LinearLayout.LayoutParams (300, 300)); }}  

मैं ब्रेकपॉइंट लगा रहा हूं, लेकिन ब्रेकपॉइंट कभी भी onDraw () विधि के अंदर नहीं मारा जाता है, क्या गलत है?

MyDrawableView कन्स्ट्रक्टर में setWillNotDraw (गलत) जोड़ें मूल उत्तर है।


Comments

Popular posts from this blog

paypal - How to know the URL referrer in PHP? -

oauth - Facebook OAuth2 Logout does not remove fb_ cookie -

wpf - Line breaks and indenting for the XAML of a saved FlowDocument? -