Skip to content

Instantly share code, notes, and snippets.

@maydin
Created September 28, 2016 08:27
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save maydin/c9669de0cd402c7d9c2dce4fe7fb15d8 to your computer and use it in GitHub Desktop.
Save maydin/c9669de0cd402c7d9c2dce4fe7fb15d8 to your computer and use it in GitHub Desktop.
public void More setFactory(ViewFactory factory) {
mFactory = factory;
obtainView();
obtainView();
}
private View obtainView() {
View child = mFactory.makeView();
LayoutParams lp = (LayoutParams) child.getLayoutParams();
if (lp == null) {
lp = new LayoutParams(LayoutParams.MATCH_PARENT, LayoutParams.WRAP_CONTENT);
}
addView(child, lp);
return child;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment