@Override protected void onMeasure(int widthMeasureSpec,int heightMeasureSpec){
  setMeasuredDimension((int)Math.min(MeasureSpec.getSize(widthMeasureSpec),halfWidth * 2),(int)Math.min(MeasureSpec.getSize(heightMeasureSpec),height));
}

@ Override protected void onMeasure ( int widthMeasureSpec , int heightMeasureSpec ) { setMeasuredDimension ( ( int ) Math . min ( MeasureSpec . getSize ( widthMeasureSpec ) , halfWidth * 2 ) , ( int ) Math . min ( MeasureSpec . getSize ( heightMeasureSpec ) , height ) ) ; }
set our view to be the minimum of the sizes that android will allow and our desired sizes
