Maybe there's an answer, but I'm unable to find it... I have a panel (with "rounded corners" via GradientDrawable). On the panel there's a label. What I need is to "calculate" if the label fits into the panel without touching the rounded corners (the label is a square and the corners may be drawn outside the rounded panel's "corners") . More exactly: Calculate the biggest possible size of the label which fits.