An onLayout is required.
On Thu, Aug 13, 2009 at 11:55 AM, Bishesh Manandhar <[email protected]>wrote:
> *I have used three custom views... playpanel works fine.. but
> drawHeaderpanel does not workk..*
>
> public class MainPanel extends Activity
> {
> @Override
> protected void onCreate(Bundle savedInstanceState) {
> super.onCreate(savedInstanceState);
>
> LinearLayout ll = new LinearLayout(this);
>
> DrawHeaderPanel header=new DrawHeaderPanel(this);
>
>
> PlayPanel cv = new PlayPanel(this);
>
>
> ll.setOrientation(LinearLayout.VERTICAL);
>
> ll.addView(header);
>
> ll.addView(cv);
>
> setContentView(ll);
> }
>
> *THE drawheaderpanel extends View*
> public DrawHeaderPanel(Context context)
> {
> super(context);
> }
>
> @Override
> public void onDraw(Canvas canvas)
> {
>
> canvas.translate(10, 10);
> mpaint.setColor(Color.GRAY);
> mpaint.setStrokeWidth(1);
> canvas.drawRect(-1, -1,320,50, mpaint);
> tTextPaint.setColor(Color.BLUE);
> canvas.drawText("Level:", 20, 20, tTextPaint);
> canvas.drawText("Score:",220,20,tTextPaint);
>
> }
>
> *onDraw renders the contents to the screen..isnt it..what else do i need
> here.. could anybody point out to me the problem here
> Plzzz help me outt.. i m stuckk herere... *
>
> >
>
--
Regards,
Sujay
Mike Ditka <http://www.brainyquote.com/quotes/authors/m/mike_ditka.html> -
"If God had wanted man to play soccer, he wouldn't have given us arms."
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google
Groups "Android Developers" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en
-~----------~----~----~----~------~----~------~--~---