API 35 - Клавиатура больше не является автоматическим разрешением или прокруткой до курсораJAVA

Программисты JAVA общаются здесь
Anonymous
API 35 - Клавиатура больше не является автоматическим разрешением или прокруткой до курсора

Сообщение Anonymous »

В Api Api Android Пример (Pre-API 35 поведение):
https://www.youtube.com/shorts/bi6d3lwqiye написано. Видимый.

Код: Выделить всё

@Override
public void onViewCreated(@NonNull View view, @Nullable Bundle savedInstanceState) {
super.onViewCreated(view, savedInstanceState);
edgeToEdge();
setWindowInsetsAnimationCallback();
}

private void setWindowInsetsAnimationCallback() {
final Rect initialPadding = new Rect(
bottomFrameLayout.getPaddingLeft(),
bottomFrameLayout.getPaddingTop(),
bottomFrameLayout.getPaddingRight(),
bottomFrameLayout.getPaddingBottom()
);

WindowInsetsAnimationCompat.Callback cb = new WindowInsetsAnimationCompat.Callback(
WindowInsetsAnimationCompat.Callback.DISPATCH_MODE_STOP) {

@Override
public WindowInsetsCompat onProgress(WindowInsetsCompat insets, List animations) {
int bottom = insets.getInsets(WindowInsetsCompat.Type.ime()).bottom +
insets.getInsets(WindowInsetsCompat.Type.systemBars()).bottom;

bottomFrameLayout.setPadding(
initialPadding.left,
initialPadding.top,
initialPadding.right,
initialPadding.bottom + bottom
);

return insets;
}
};

ViewCompat.setWindowInsetsAnimationCallback(bottomFrameLayout, cb);
}

private void edgeToEdge() {
final Rect initialPadding = new Rect(
bottomFrameLayout.getPaddingLeft(),
bottomFrameLayout.getPaddingTop(),
bottomFrameLayout.getPaddingRight(),
bottomFrameLayout.getPaddingBottom()
);

ViewCompat.setOnApplyWindowInsetsListener(bottomFrameLayout, (v, insets) -> {
Insets theInsets = insets.getInsets(
WindowInsetsCompat.Type.systemBars() | WindowInsetsCompat.Type.displayCutout()
);

v.setPadding(
initialPadding.left + theInsets.left,
initialPadding.top,
initialPadding.right + theInsets.right,
initialPadding.bottom + theInsets.bottom
);

return insets;
});
}
Проблема:

scrollview не автоматически прокрутки, чтобы держать курсор видимым, когда клавиатура появляется

Регулирующая прокладка. /> видео о проблеме:
https://youtube.com/shorts/du3fg2c91js? ... areобразно Изменение размера и прокрутки-в Комрур-надежным образом?>

Подробнее здесь: https://stackoverflow.com/questions/797 ... -to-cursor

Вернуться в «JAVA»