FIX: CustomPhoneKeyboardView.java fix keyboard's size

This commit is contained in:
liuhuibin 2024-07-17 12:33:18 +08:00 committed by GitHub
parent 5fa5549a4a
commit 08e992a1ef
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -211,7 +211,7 @@ public class CustomPhoneKeyboardView extends ViewGroup {
@Override @Override
protected void onLayout(boolean changed, int l, int t, int r, int b) { protected void onLayout(boolean changed, int l, int t, int r, int b) {
int btnWidth = (getWidth() - AndroidUtilities.dp(SIDE_PADDING * 2 + BUTTON_PADDING * 2)) / 3; int btnWidth = (getWidth() - AndroidUtilities.dp(SIDE_PADDING * 2 + BUTTON_PADDING * 2)) / 3;
int btnHeight = (getHeight() - AndroidUtilities.dp(SIDE_PADDING * 3 + BUTTON_PADDING * 2)) / 4; int btnHeight = (getHeight() - AndroidUtilities.dp(SIDE_PADDING * 2 + BUTTON_PADDING * 3)) / 4;
for (int i = 0; i < views.length; i++) { for (int i = 0; i < views.length; i++) {
int rowX = i % 3, rowY = i / 3; int rowX = i % 3, rowY = i / 3;
@ -228,7 +228,7 @@ public class CustomPhoneKeyboardView extends ViewGroup {
setMeasuredDimension(MeasureSpec.getSize(widthMeasureSpec), MeasureSpec.getSize(heightMeasureSpec)); setMeasuredDimension(MeasureSpec.getSize(widthMeasureSpec), MeasureSpec.getSize(heightMeasureSpec));
int btnWidth = (getWidth() - AndroidUtilities.dp(SIDE_PADDING * 2 + BUTTON_PADDING * 2)) / 3; int btnWidth = (getWidth() - AndroidUtilities.dp(SIDE_PADDING * 2 + BUTTON_PADDING * 2)) / 3;
int btnHeight = (getHeight() - AndroidUtilities.dp(SIDE_PADDING * 3 + BUTTON_PADDING * 2)) / 4; int btnHeight = (getHeight() - AndroidUtilities.dp(SIDE_PADDING * 2 + BUTTON_PADDING * 3)) / 4;
for (View v : views) { for (View v : views) {
if (v != null) { if (v != null) {