Skip to content

Instantly share code, notes, and snippets.

@slezica
Created June 26, 2015 19:25
Show Gist options
  • Save slezica/eeb7924745573a2ca2ee to your computer and use it in GitHub Desktop.
Save slezica/eeb7924745573a2ca2ee to your computer and use it in GitHub Desktop.
Loading XML in custom Android View
package view;
public class CustomComplexView extends FrameLayout {
public CustomComplexView(Context context) {
super(context);
init();
}
public CustomComplexView(Context context, AttributeSet attrs) {
super(context, attrs);
init();
}
public CustomComplexView(Context context, AttributeSet attrs, int defStyle) {
super(context, attrs, defStyle);
init();
}
void init() {
addView(inflate(getContext(), R.layout.complex_view_layout, null));
// mSubView1 = findViewById(R.id.foo);
// mSubView2 = findViewById(R.id.bar);
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment