Skip to content

Conversation

@NathanWalker
Copy link
Contributor

Margins are now honored for items in the Android ListView component, ensuring consistent spacing with iOS.

Context: Android ListView ignores margins on the item root by design; each row’s root view is attached with AbsListView.LayoutParams, which doesn't support margins. These changes allow for consistent expectations for user layouts across iOS and Android.

When using a ListView with a setup similar to the following:

<ListView>
    <template>
        <GridLayout margin="2 6 2 6">
            <!-- Label's, etc. -->
        </GridLayout>
    </template>
</ListView>

Before:
before-listview

After:
after-listview

@NathanWalker NathanWalker added this to the 9.0 milestone Nov 5, 2025
@nx-cloud
Copy link

nx-cloud bot commented Nov 5, 2025

View your CI Pipeline Execution ↗ for commit 882f048

Command Status Duration Result
nx test apps-automated -c=android ✅ Succeeded 5m 4s View ↗
nx run-many --target=test --configuration=ci --... ✅ Succeeded <1s View ↗

☁️ Nx Cloud last updated this comment at 2025-11-05 23:03:06 UTC

@NathanWalker NathanWalker changed the title fix(android): ListView now honors margin on layout containers fix(android): ListView margin handling on layout containers Nov 5, 2025
@NathanWalker NathanWalker requested a review from Copilot November 5, 2025 06:13
Copy link

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull Request Overview

This PR enhances Android ListView to properly respect margin properties defined on list item template roots. Previously, margins were ignored because ListView children don't natively support layout margins on Android.

  • Adds logic to detect margins on item template views and wrap them in an outer StackLayout when needed
  • Updates comments to clarify the wrapping behavior for both layout and non-layout template roots
  • Imports PercentLength utility to correctly convert margin values to device pixels

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

@NathanWalker NathanWalker merged commit 65c8163 into main Nov 5, 2025
5 of 6 checks passed
@NathanWalker NathanWalker deleted the feat/android-list-view-margin-handling branch November 5, 2025 22:54
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants