Skip to content

ListView with rounded items can not show the background of Page #1290

Closed

Description

@AllenMeex

Hi all,

I want to make a ListView and its items is rounded. The round part should show the background of the Page. But I get a round part with White.

xml:

<Page xmlns="http://www.nativescript.org/tns.xsd" backgroundColor="#FF00FF00">
    <ListView items="[[" marginTop="20" backgroundColor="#00000000">
      <ListView.itemTemplate>
          <Label text="AABBCC" verticalAlignment="stretch" backgroundColor="#30000000" style="text-align:center; border-width:1; border-radius:20"/>
      </ListView.itemTemplate>
    </ListView>
</Page>

Result:
image

How can I set the color of white part to GREEN ?

Regards.

Activity

  1. added this to the milestone on Dec 23, 2015
  2. PanayotCankov commented on Jan 4, 2016

    @PanayotCankov
    Contributor

    The UITableViewCell in iOS renders the background. You can consider clearing its background using the native background from the itemLoading event:

    <Page xmlns="http://www.nativescript.org/tns.xsd" backgroundColor="#FF00FF00">
        <ListView items="[[" marginTop="20" backgroundColor="blue" itemLoading="onItemLoading">
          <ListView.itemTemplate>
              <Label text="AABBCC" verticalAlignment="stretch" />
          </ListView.itemTemplate>
        </ListView>
    </Page>
    exports.onItemLoading = function(args) {
        args.ios.backgroundColor = UIColor.clearColor();
    }
  3. hshristov commented on Jan 5, 2016

    @hshristov
    Contributor

    @AllenMeex Will this works for you?

  4. AllenMeex commented on Jan 7, 2016

    @AllenMeex
    Author

    Thx, @PanayotCankov , It works!!

  5. Freshchris01 commented on Oct 16, 2016

    @Freshchris01

    It didn't work for me.
    but

    args.ios.backgroundColor = UIColor.clear
    

    worked for me.

  6. lock commented on Aug 29, 2019

    @lock

    This thread has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs.

  7. locked and limited conversation to collaborators on Aug 29, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

      Milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions