复选框默认大小是多少
What is the checkbox default size
checkbox
具有固定大小。我想知道 checkbox
默认倾角尺寸。或者我怎样才能获得默认的倾角大小。
您可以重写 onWindowFocusChanged
方法并在其中以编程方式计算 CheckBox
width/height
@Override
public void onWindowFocusChanged(boolean hasFocus) {
super.onWindowFocusChanged(hasFocus);
int checkBoxWidthInPx = mCheckBox.getWidth(); // return the width of your checkbox, in pixels.
int checkBoxHeightInPx = mCheckBox.getHeight();
// conver px to dp
int checkBoxWidthInDp = checkBoxWidthInPx / this.getResources().getDisplayMetrics().density
int checkBoxHeightInDp = checkBoxHeightInPx / this.getResources().getDisplayMetrics().density
}
checkbox
具有固定大小。我想知道 checkbox
默认倾角尺寸。或者我怎样才能获得默认的倾角大小。
您可以重写 onWindowFocusChanged
方法并在其中以编程方式计算 CheckBox
width/height
@Override
public void onWindowFocusChanged(boolean hasFocus) {
super.onWindowFocusChanged(hasFocus);
int checkBoxWidthInPx = mCheckBox.getWidth(); // return the width of your checkbox, in pixels.
int checkBoxHeightInPx = mCheckBox.getHeight();
// conver px to dp
int checkBoxWidthInDp = checkBoxWidthInPx / this.getResources().getDisplayMetrics().density
int checkBoxHeightInDp = checkBoxHeightInPx / this.getResources().getDisplayMetrics().density
}