Wednesday, September 7, 2011

[android-developers] custom viewgroup with a background.

Hello guys,

I want to create a custom widget.

Basically it is something like a toolBar,

I want to draw a background first, and draw my tool buttons on top of
the background.

However, it doesn't work.

What I did is I overrided the onDraw Function

@Override
protected void onDraw(Canvas canvas)
{
custom draw...
}

But it seems that this function never gets called. I can only see my
tool buttons, but not the background. What should I do?


I have another question about calling the parent function from the
overrided function in java.


suppose I have a function named kkk which overrides the function aaa,
if I want to call aaa from kkk, I wrote:

@Override
protected void kkk()
{
super();
}

The problem is, I want to do something before calling aaa

@Override
protected void kkk()
{
//do something here....

super();
}

But java doesn't allow me to do this, it says that super must be the
first thing inside the function.

So how can I call super() after some other code?

thanks.

--
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+unsubscribe@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en

0 Comments:

Post a Comment

Subscribe to Post Comments [Atom]

<< Home


Real Estate