安卓 12 设备上键盘无法显示,出现覆盖层表明键盘已打开但没有显示。在旧版安卓系统中正常工作。
键盘在其他应用程序中工作正常,并且在 Android 12 以外的模拟器中也可以正常工作。已尝试使用物理设备,像 Pixel 安卓 12 版本也遇到了相同的问题。
flutter doctor 代码:
flutter doctor -v
[✓] Flutter (Channel stable, 2.2.3, on macOS 11.4 20F71 darwin-x64, locale en-IN)
• Flutter version 2.2.3 at /Users/uable/Downloads/flutter
• Framework revision f4abaa0735 (4 months ago), 2021-07-01 12:46:11 -0700
• Engine revision 241c87ad80
• Dart version 2.13.4
[✓] Android toolchain - develop for Android devices (Android SDK version 31.0.0)
• Android SDK at /Users/uable/Library/Android/sdk
• Platform android-31, build-tools 31.0.0
• ANDROID_HOME = /Users/uable/Library/Android/sdk
• ANDROID_SDK_ROOT = /Users/uable/Library/Android/sdk
• Java binary at: /Applications/Android Studio.app/Contents/jre/jdk/Contents/Home/bin/java
• Java version OpenJDK Runtime Environment (build 1.8.0_242-release-1644-b3-6222593)
• All Android licenses accepted.
[!] Xcode - develop for iOS and macOS
✗ Xcode installation is incomplete; a full installation is necessary for iOS development.
Download at: https://developer.apple.com/xcode/download/
Or install Xcode via the App Store.
Once installed, run:
sudo xcode-select --switch /Applications/Xcode.app/Contents/Developer
sudo xcodebuild -runFirstLaunch
• CocoaPods version 1.10.2
[✓] Chrome - develop for the web
• Chrome at /Applications/Google Chrome.app/Contents/MacOS/Google Chrome
[✓] Android Studio (version 4.1)
• Android Studio at /Applications/Android Studio.app/Contents
• Flutter plugin can be installed from:
https://plugins.jetbrains.com/plugin/9212-flutter
• Dart plugin can be installed from:
https://plugins.jetbrains.com/plugin/6351-dart
• Java version OpenJDK Runtime Environment (build 1.8.0_242-release-1644-b3-6222593)
[✓] Connected device (2 available)
• sdk gphone64 x86 64 (mobile) • emulator-5554 • android-x64 • Android 12 (API 31) (emulator)
• Chrome (web) • chrome • web-javascript • Google Chrome 95.0.4638.54
! Doctor found issues in 1 category.
以下是一个简单文本字段和键盘的图像,我尝试了修改所有文本字段的属性,但还是无法解决问题。这是一款现有应用程序,所以我尝试测试现有的文本字段,即使在这些字段中也显示相同的行为。
安卓Gradle设置
minSdkVersion 24
targetSdkVersion 30
android:hardwareAccelerated="true"
已正确设置,但我的Webview不显示键盘...(仅在Android 12上,在物理设备上...) - Didier Prophete(Platform.isAndroid) WebView.platform = SurfaceAndroidWebView();
。基本上,将 WebView 放入混合组合模式(请参见 https://pub.dev/packages/webview_flutter)。 - Didier Prophete