'how can I change keyboard backdrop color with jetpack compose?
I am using jetpack compose for Android development.
In dark mode, the background of the TextField is Color.Black. However, after tapping on the TextField, when the keyboard is displayed, the background color changes to white for a moment.
This seems to be due to the use of adjustResize. However, without it, some parts of the text will be off the screen and cannot be edited while typing. Therefore, I believe either of the following is an improvement.
- Change the color to black while maintaining adjustResize.
- Solve the above problem of text sticking out in a different way than adjustResize
This is very ugly. How can I change this white background to black?
Thank you in advance.
class EditorActivity : ComponentActivity() {
override fun onCreate(savedInstanceState: Bundle?) {
super.onCreate(savedInstanceState)
setContent {
TextField(
value = "",
onValueChange = {},
modifier = Modifier.background(Color.Black).fillMaxSize()
)
}
}
}
my activity setting in AndroidManifest.xml
<activity
android:name=".ui.screen.episodeEdit.EditorActivity"
android:exported="false"
android:theme="@style/Theme.Nobel_editor"
android:windowSoftInputMode="adjustResize"></activity>
Solution 1:[1]
I used jetpack compose 1.1.1.
After change version to 1.2.0-alpha07, fullsize TextField doesn't hide text without adjustResize option. so I could remove adjustResize. and Keyboard backdrop changed to black.
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|---|
| Solution 1 | msickpaler |



