Skip to content

[Card] Inconsistent alignment of elements #4988

@patrickfrei

Description

@patrickfrei

Description: I've created a manual list with several cards (leading icon, text, trailing switch / radio button / checkbox) and applied a shapeAppearance to them (com.google.android.material.listitem.ListItemCardView) as follows:

  • First item: app:shapeAppearance="@style/ShapeAppearance.Material3.ListItem.First"
  • Middle item: app:shapeAppearance="@style/ShapeAppearance.Material3.ListItem.Middle"
  • Last item: app:shapeAppearance="@style/ShapeAppearance.Material3.ListItem.Last"

Now, I've observed that the elements of the card items in the middle of the list are inconsistently aligned compared to the first and last items (left and right side; see screenshots below).

Image Image

Expected behavior: The elements of all card items in the list are consistently aligned (left and right side).

Note: Using app:cardPreventCornerOverlap="false" and the first and last items (partially) corrects the alignment (in case of using text views only) but I'm not sure if this is the correct way to "fix" it.

Source code: See XML here.

Minimal sample app repro: See XML here.

Android API version: API 36

Material Library version: 1.14.0-alpha08

Device: Google Pixel 9 Pro

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions