Skip to content

Instantly share code, notes, and snippets.

@swarut
Created April 10, 2012 21:37
Show Gist options
  • Save swarut/2354762 to your computer and use it in GitHub Desktop.
Save swarut/2354762 to your computer and use it in GitHub Desktop.
Android : Custom view from ViewGroup
public class MyCustomView extends LinearLayout{
public MyCustomView(Context context, AttributeSet attrs, int defStyle) {
super(context, attrs, defStyle);
View.inflate(context, R.layout.your_layout_name, this);
}
public MyCustomView(Context context, AttributeSet attrs) {
this(context, null, 0);
}
public MyCustomView(Context context) {
this(context, null);
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment