- MainActivity 인셋 리스너에 IME 인셋 반영: 하단 패딩 = max(시스템바, 키보드 높이) → 키보드가 뜨면 WebView가 키보드 위로 줄어들어 입력 모달이 재배치됨 - AndroidManifest activity에 windowSoftInputMode=adjustResize 추가 - 모달은 기존 max-height+overflow로 스크롤되어 모든 필드 확인 가능 - 네이티브 전용(웹/PC 무영향) → APK 재빌드 필요 Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
This commit is contained in:
@@ -13,6 +13,7 @@
|
|||||||
android:label="@string/title_activity_main"
|
android:label="@string/title_activity_main"
|
||||||
android:theme="@style/AppTheme.NoActionBarLaunch"
|
android:theme="@style/AppTheme.NoActionBarLaunch"
|
||||||
android:launchMode="singleTask"
|
android:launchMode="singleTask"
|
||||||
|
android:windowSoftInputMode="adjustResize"
|
||||||
android:exported="true">
|
android:exported="true">
|
||||||
<intent-filter>
|
<intent-filter>
|
||||||
<action android:name="android.intent.action.MAIN" />
|
<action android:name="android.intent.action.MAIN" />
|
||||||
|
|||||||
@@ -23,7 +23,11 @@ public class MainActivity extends BridgeActivity {
|
|||||||
final View content = findViewById(android.R.id.content);
|
final View content = findViewById(android.R.id.content);
|
||||||
ViewCompat.setOnApplyWindowInsetsListener(content, (v, windowInsets) -> {
|
ViewCompat.setOnApplyWindowInsetsListener(content, (v, windowInsets) -> {
|
||||||
Insets bars = windowInsets.getInsets(WindowInsetsCompat.Type.systemBars());
|
Insets bars = windowInsets.getInsets(WindowInsetsCompat.Type.systemBars());
|
||||||
v.setPadding(bars.left, bars.top, bars.right, bars.bottom);
|
Insets ime = windowInsets.getInsets(WindowInsetsCompat.Type.ime());
|
||||||
|
// 키보드(IME)가 올라오면 그 높이만큼 하단 패딩 → WebView가 키보드 위로 줄어든다.
|
||||||
|
// (입력 모달이 키보드에 가려지지 않고, 포커스된 입력칸이 보이도록 재배치됨)
|
||||||
|
int bottom = Math.max(bars.bottom, ime.bottom);
|
||||||
|
v.setPadding(bars.left, bars.top, bars.right, bottom);
|
||||||
return WindowInsetsCompat.CONSUMED;
|
return WindowInsetsCompat.CONSUMED;
|
||||||
});
|
});
|
||||||
ViewCompat.requestApplyInsets(content);
|
ViewCompat.requestApplyInsets(content);
|
||||||
|
|||||||
Reference in New Issue
Block a user