Skip to content

Add z-index to the public API #2151

Closed

Description

@zeroum

The zIndex property only exists in https://github.com/NativeScript/NativeScript/blob/master/ui/styling/style.d.ts

but not in
https://github.com/NativeScript/NativeScript/blob/master/ui/styling/styling.d.ts

where it could be found by the TypeScript compiler and tools.

Is it meant to be private API thing?

Activity

  1. self-assigned this
    on May 20, 2016
  2. NickIliev commented on May 20, 2016

    @NickIliev
    Contributor

    @zeroum

    Thank you for noticing this issue - indeed the zIndex should be exposed in both files.

  3. assigned and unassigned on May 20, 2016
  4. added this to the 2.1 milestone on May 20, 2016
  5. spstratis commented on Jun 23, 2016

    @spstratis

    Is it planned to add z-index support to all API levels that are supported by Nativescript? For example API 19?

  6. NickIliev commented on Jun 23, 2016

    @NickIliev
    Contributor

    @spstratis for API levels below 21 you can use as a workaround an absolute layout and order your elements - the last one will be placed on top.
    For example:

        <AbsoluteLayout>
            <GridLayout width="200" height="200" backgroundColor="red" id="mr-red"/>
            <GridLayout width="100" height="100" backgroundColor="green" id="mr-green"/>
            <GridLayout width="50" height="50" backgroundColor="blue" id="mr-blue"/>
        </AbsoluteLayout>
    

    If you want to dynamically change the order of an element you can again use the native API method bringToFront()

    For example:
    in your page.xml (three blocks but the smallest (mr-blue) will be hidden behind the green one)

        <AbsoluteLayout>
            <GridLayout width="200" height="200" backgroundColor="red" id="mr-red"/>
            <GridLayout width="50" height="50" backgroundColor="blue" id="mr-blue"/>
            <GridLayout width="100" height="100" backgroundColor="green" id="mr-green"/>
        </AbsoluteLayout>
    

    in your page.js

    var blue = page.getViewById("mr-blue");
    blue.android.bringToFront();
    

    This will bring mr-blue to the front

  7. spstratis commented on Jun 26, 2016

    @spstratis

    @NickIliev Thanks, I will try this out and see if it works. In my case everything is within a GridLayout.

  8. 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.

  9. 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

    Type

    No type

    Projects

    No projects

      Milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions