public class MyView extends View { public MyView(Context context) { super(context); } @Override protected void onLayout(boolean changed, int left, int top, int right, int bottom) { super.onLayout(changed, left, top, right, bottom); // compute the position of child views and layout them // ... } }In this example, the onLayout() method is overridden to layout the child views of the custom view. The View class is part of the android.view package library.