Android gets the size of the left selection box of RadioButton and CheckBox

// RadioButton
int width = new RadioButton(getContext()).getButtonDrawable().getIntrinsicWidth();
int height = new RadioButton(getContext()).getButtonDrawable().getIntrinsicHeight();

// CheckBox
int width = new CheckBox(getContext()).getButtonDrawable().getIntrinsicWidth();
int height = new CheckBox(getContext()).getButtonDrawable().getIntrinsicHeight();

For the record, because the function needs to be rewritten, the comments are too messy, so I will delete them. . .

But I am afraid that I will forget it, and I may use it again in the future. . .

Guess you like

Origin blog.csdn.net/qq_54087555/article/details/132234353