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

[MaterialAlertDialogBuilder] Title and Subtitle are overlapping in Android 12 devices and samsung devices

Open
#3,346 1 comment 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:** Full description of issue here

**Expected behavior:** Screenshots and/or description of expected behavior

**Source code:** The code snippet which is causing this issue
` fun Context.showCustomAlertDialog(
strTitle: String,
strMsg: CharSequence,
strPositive: String,
onPositiveClick: () -> Unit
) {
val builder = MaterialAlertDialogBuilder(this, R.style.MaterialAlertDialog_Rounded)
builder.setTitle(setTypeface(setMediumTypeface(), strTitle))
builder.setMessage(setTypeface(setRegularTypeface(), strMsg))
builder.setPositiveButton(
strPositive
) { _, _ -> onPositiveClick() }
val dialog = builder.create()
dialog.show()
dialog.setCanceledOnTouchOutside(false)
dialog.setCancelable(false)
val positiveBtn = dialog.getButton(AlertDialog.BUTTON_POSITIVE)
positiveBtn.letterSpacing = -0.01F

} `
`
<item name="shapeAppearanceOverlay">
@style/ShapeAppearanceOverlay.MaterialAlertDialog.Rounded
</item>
<item name="buttonBarPositiveButtonStyle">@style/Widget.App.Button</item>
<item name="android:windowTranslucentStatus">false</item>
<item name="android:paddingTop">@dimen/_1sdp</item>
<item name="android:paddingBottom">@dimen/_1sdp</item>
<item name="buttonBarNeutralButtonStyle">@style/Widget.App.Button</item>
<item name="materialAlertDialogTitleTextStyle">@style/MyTitle</item>
<item name="materialAlertDialogBodyTextStyle">@style/BodyTextStyle</item>
<item name="buttonBarNegativeButtonStyle">@style/NegButtonStyle</item>
<item name="android:layout_width">wrap_content</item>
<item name="android:layout_height">wrap_content</item>

`
**Minimal sample app repro:** Please consider attaching a minimal sample app that reproduces the issue. This will help narrow down the conditions required for reproducing the issue, and it will speed up the bug-fix process. You may attach a zip file of the sample app or a link to a GitHub repo that contains the sample app.

**Android API version:** Android API version here

**Material Library version:** Material Android Library version you are using here (e.g., 1.8.0)

**Device:** Device on which the bug was encountered on Pixel devices and Samsung m33

To help us triage faster, please check to make sure you are using the [latest version](https://github.com/material-components/material-components-android/releases) of the library.

We also happily accept [pull requests](https://github.com/material-components/material-components-android/pulls).

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 by reproducing the overlap with the provided Context.showCustomAlertDialog snippet and MaterialAlertDialog.Rounded style on Android 12, a Pixel device, and Samsung M33. Inspect the MaterialAlertDialogBuilder title and body text styles shown in the issue. Done means the title and subtitle no longer overlap across the reported devices.

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
20/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.