material-components / material-components/material-components-android

[TextInputEditText +BottomSheetDialogFragment] Input method buttons cannot be displayed on Android12

Open
#4,256 3 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

bug Need more info
Dominant language
Java
Stars
17.4k
Forks
3.2k
PR merge metrics
No merged PRs in 30d

Description

**Description:** On Android 12 devices, the input method that pops up by clicking on the input box is gray and cannot be entered normally

**Expected behavior:** 如图所示,点击输入框后弹出的是灰色的一片内容,
![image](https://github.com/user-attachments/assets/4a4f6d53-849a-4465-8583-d4a89e6f8167)

**Source code:**

```xml
# xml file




```

```kotlin
# in kotlin code
class AddressInputDialog : BottomSheetDialogFragment() {
lateinit var binding: AddressInputDialogBinding
private set

var log: Logger
private set
private val model: CommonModel by viewModels { ViewModelProvider.NewInstanceFactory() }

init {
log = LoggerFactory.getLogger(AddressInputDialog::class.java)
}

override fun onCreateView(
inflater: LayoutInflater,
container: ViewGroup?,
savedInstanceState: Bundle?
): View? {
binding = AddressInputDialogBinding.inflate(inflater, container, false)
val ret: View = binding.root
initView()
return ret
}

fun initView() {
val properties = Tools.loadConfig(context, "config.properties")
if (properties.getProperty("ServerUrl") != null) {
if (properties.getProperty("ip") != null) {

binding.ipInput.setText(properties.getProperty("ip"))
binding.portInput.setText(properties.getProperty("port"))
} else {
val regex = "http://([0-9]+\\.[0-9]+\\.[0-9]+\\.[0-9]+):([0-9]+)/.*".toRegex()
val matchResult = regex.find(properties.getProperty("ServerUrl")!!)
if (matchResult != null) {
val ip = matchResult.groupValues[1]
val name = matchResult.groupValues[2]
binding.ipInput.setText(ip)
binding.portInput.setText(name)
}

}
} else {
binding.ipInput.setText("192.168.18.110")
binding.portInput.setText("8082")
}
binding.done.setOnClickListener {
val ip = binding.ipInput.text.toString()
if (ip.isEmpty()) {
binding.ipInput.error = getString(R.string.add_input_tip_1)
return@setOnClickListener
}
val port = binding.portInput.text.toString()
if (port.isEmpty()) {
binding.portInput.error = getString(R.string.add_input_tip_2)
return@setOnClickListener
}
val ipPattern =
"^((25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)\\.){3}(25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)$"
val domainPattern =
"^(?=^.{1,253}$)(^(?:(?!\\d|-)[a-zA-Z0-9\\-]{1,63}(?

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start with the provided AddressInputDialog, its BottomSheetDialogFragment entry point, and the TextInputEditText layout. Reproduce the input flow on Android API 31 using the supplied XML and Kotlin, then compare behavior across the reported devices. Done means the input method is usable when either field is focused without regressing the bottom-sheet UI.

Written by the indexing model from the issue text.

Assessment

Tech stack
android, kotlin, xml
Domain
mobile
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.