Wednesday, 2 September 2015

View Class Example in Android


public class AboutActivity extends Activity{
AboutView mAbout;
@Override
protected void onCreate(Bundle savedInstanceState) {
// TODO Auto-generated method stub
super.onCreate(savedInstanceState);

mAbout =new AboutView(this);

                setContentView(mAbout );
}

}



public class AboutView extends View {
Rect mRectBackground;
Bitmap mBackground;
Paint mPaint;
public AboutView(Context context) {
super(context);
// TODO Auto-generated constructor stub
//initialize all the bitmaps and rect
}

@Override
protected void onDraw(Canvas canvas) {
// TODO Auto-generated method stub
super.onDraw(canvas);
              //Draw here ............
}

}

No comments:

Post a Comment