雑にdivider引くときめんどくさかったので。
CustomView.java
public class CustomView extends View {
public CustomView(Context context) {
this(context, null);
}
public CustomView(Context context, AttributeSet attrs) {
this(context, attrs, 0);
}
public CustomView(Context context, AttributeSet attrs, int defStyleAttr) {
super(context, attrs, defStyleAttr);
}
@Override
protected void onMeasure(int widthMeasureSpec, int heightMeasureSpec) {
Drawable background = getBackground();
int width = background != null ? background.getIntrinsicWidth() : 0;
int height = background != null ? background.getIntrinsicHeight() : 0;
setMeasuredDimension(
View.resolveSize(width, widthMeasureSpec),
View.resolveSize(height, heightMeasureSpec));
}
}