Skip to content

Instantly share code, notes, and snippets.

@flavienlaurent
Created September 23, 2013 08:26
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 flavienlaurent/6667867 to your computer and use it in GitHub Desktop.
Save flavienlaurent/6667867 to your computer and use it in GitHub Desktop.
Statement conflict
import android.content.Context;
import android.util.AttributeSet;
import android.view.ViewGroup;
public class MyCustomViewGroup extends ViewGroup {
public MyCustomViewGroup(Context context) {
super(context);
// TODO Auto-generated constructor stub
}
public MyCustomViewGroup(Context context, AttributeSet attrs) {
super(context, attrs);
// TODO Auto-generated constructor stub
}
public MyCustomViewGroup(Context context, AttributeSet attrs, int defStyle) {
super(context, attrs, defStyle);
// TODO Auto-generated constructor stub
}
@Override
protected void onLayout(boolean changed, int l, int t, int r, int b) {
// TODO Auto-generated method stub
}
/**
* @see android.view.ViewGroup#checkLayoutParams(android.view.ViewGroup.LayoutParams)
*/
@Override
protected boolean checkLayoutParams(ViewGroup.LayoutParams p) {
return p instanceof LayoutParams;
}
/**
* @see android.view.ViewGroup#generateDefaultLayoutParams()
*/
@Override
protected LayoutParams generateDefaultLayoutParams() {
return new LayoutParams(LayoutParams.WRAP_CONTENT, LayoutParams.WRAP_CONTENT);
}
/**
* @see android.view.ViewGroup#generateLayoutParams(android.util.AttributeSet)
*/
@Override
public LayoutParams generateLayoutParams(AttributeSet attributeSet) {
return new LayoutParams(getContext(), attributeSet);
}
/**
* @see android.view.ViewGroup#generateLayoutParams(android.view.ViewGroup.LayoutParams)
*/
@Override
protected LayoutParams generateLayoutParams(ViewGroup.LayoutParams p) {
return new LayoutParams(p);
}
public static class LayoutParams extends ViewGroup.LayoutParams {
public LayoutParams(Context context, AttributeSet attributeSet) {
super(context, attributeSet);
}
public LayoutParams(int width, int height) {
super(width, height);
}
public LayoutParams(ViewGroup.LayoutParams layoutParams) {
super(layoutParams);
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment