material-components / material-components/material-components-android
[MaterialAlertDialogBuilder] Automatic resizing of MaterialAlertDialogBuilder height when the keyboard is open
Nobody has claimed this yet.
- Dominant language
- Java
- Stars
- 17.4k
- Forks
- 3.2k
- PR merge metrics
- No merged PRs in 30d
Description
Description: I have built a custom dialog with MaterialAlertDialogBuilder. The dialog has 2 TextInputLayouts. The problem is when I try to write something in the TextInputEditText and when the keyboard is visible, the MaterialAlertDialogBuilder shrinks in height.
Expected behavior: I want to prevent automatic resizing of MaterialAlertDialogBuilder height when the keyboard is open.
Source code: In XML:
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="vertical"
android:padding="16dp"
tools:viewBindingIgnore="true">
<com.google.android.material.textfield.TextInputLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:hint="দোয়া"
app:endIconMode="clear_text"
app:shapeAppearance="@style/ShapeAppearance.App.SmallComponent"
tools:viewBindingIgnore="true">
<com.google.android.material.textfield.TextInputEditText
android:id="@+id/doarName"
android:layout_width="match_parent"
android:layout_height="wrap_content" />
</com.google.android.material.textfield.TextInputLayout>
<com.google.android.material.textfield.TextInputLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginTop="11dp"
android:hint="দৈনিক কতবার পাঠ করবেন?"
app:endIconMode="clear_text"
app:shapeAppearance="@style/ShapeAppearance.App.SmallComponent"
tools:viewBindingIgnore="true">
<com.google.android.material.textfield.TextInputEditText
android:id="@+id/number"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:inputType="number" />
</com.google.android.material.textfield.TextInputLayout>
</LinearLayout>
In Kotlin:
MaterialAlertDialogBuilder(this@TosbiActivity).setView(view).setTitle("দোয়া যুক্ত করুন")
.setPositiveButton("Apply") { dialog, _ ->
/*
......
*/
dialog.dismiss()
}.setNegativeButton("Cancel") { dialog, _ ->
dialog.dismiss()
}.show()
Android API version: 33
Material Library version: 1.11.0
Device: Symphony i69, Display 5.7″ (1440 x 720 pixels)
Screen Record:
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start by reproducing the dialog behavior from the provided XML layout and Kotlin MaterialAlertDialogBuilder setup with the keyboard open on Android API 33 and Material Library 1.11.0. Determine whether the height change comes from the dialog, its layout, or keyboard handling; done means the dialog preserves the intended height while text fields remain usable.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- android, kotlin
- Domain
- mobile
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Needs clarification
- Newbie friendliness
- 25/100