I\'m learning about using Custom Views from the following:
http://developer.android.com/guide/topics/ui/custom-components.html#modifying
The description says
Here's a my pattern (creating a custom ViewGoup
here, but still):
// CustomView.java
public class CustomView extends LinearLayout {
public CustomView(Context context) {
super(context);
init(context);
}
public CustomView(Context context, AttributeSet attrs) {
super(context, attrs);
init(context);
}
public CustomView(Context context, AttributeSet attrs, int defStyle) {
super(context, attrs, defStyle);
init(context);
}
private void init(Context ctx) {
LayoutInflater.from(ctx).inflate(R.layout.view_custom, this, true);
// extra init
}
}
and
// view_custom.xml