Nativescript: How to give the border shown in the image

Created on 2 May 2016  路  3Comments  路  Source: NativeScript/NativeScript

color

question

Most helpful comment

Hello @dhanalakshmitawwa

Border element is one option but keep in mind that this element depricated.

The better solutioin is to use CSS properties to apply border on your UI elements.
_For example:_

app.css

.bordered {
    border-width: 2; 
    border-color: #FF0000;
}

your-page.xml

<Page>
    <StackLayout class="bordered">
        <Label text="my label" />
    </StackLayout>
</Page>

Here is the article about styling with CSS and all the supported CSS properties in NativeScript
https://docs.nativescript.org/ui/styling

All 3 comments

<GridLayout columns="*,*" >
    <ContentView col="0" row="0">
        <Border borderRadius="0" borderWidth="1" borderColor="#FF0000">
              <Button text="Profile" tap="btnProfileClick"   width="100%" height="100%"/>
         </Border>
     </ContentView>
     <ContentView col="1" row="0">
         <Border borderRadius="0" borderWidth="1" borderColor="#FF0000">
             <Button text="Setting" tap="btnSettingClick"   width="100%" height="100%"/>
        </Border>`
    </ContentView>`
</GridLayout>

Hello @dhanalakshmitawwa

Border element is one option but keep in mind that this element depricated.

The better solutioin is to use CSS properties to apply border on your UI elements.
_For example:_

app.css

.bordered {
    border-width: 2; 
    border-color: #FF0000;
}

your-page.xml

<Page>
    <StackLayout class="bordered">
        <Label text="my label" />
    </StackLayout>
</Page>

Here is the article about styling with CSS and all the supported CSS properties in NativeScript
https://docs.nativescript.org/ui/styling

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.

Was this page helpful?
0 / 5 - 0 ratings

Related issues

mourice picture mourice  路  3Comments

rLoka picture rLoka  路  3Comments

OscarLopezArnaiz picture OscarLopezArnaiz  路  3Comments

minjunlan picture minjunlan  路  3Comments

vtisnado picture vtisnado  路  3Comments