@Override protected void onMeasure(int widthMeasureSpec, int heightMeasureSpec) { int height = mDrawable.getIntrinsicHeight() + getPaddingTop() + getPaddingBottom(); heightMeasureSpec = MeasureSpec.makeMeasureSpec(height, MeasureSpec.EXACTLY); super.onMeasure(widthMeasureSpec, heightMeasureSpec); }
@Override protected void onLayout(boolean changed, int left, int top, int right, int bottom) { final int size = mDrawable.getIntrinsicHeight(); mDrawable.setBounds(0, 0, size, size); }