Search code examples
nativescriptangular2-nativescriptnativescript-angular

image icon in segmented bar in nativescript


how to add the image icon in the segmented bar in nativescript-angular. can you please help me with this

 <SegmentedBar #tabs [selectedIndex]="selectSegment">
                <SegmentedBarItem title="test1"></SegmentedBarItem>
                <SegmentedBarItem title="test2"></SegmentedBarItem>
                <SegmentedBarItem title="test3"></SegmentedBarItem>
                <SegmentedBarItem title="test4"></SegmentedBarItem>
        </SegmentedBar>

Solution

  • the SegmentedBar does not have options to assign images for each SegmentedBarItem. This is a valid scenario for TabView. For SegmentedBar you can only set background-image for the whole Segmented bar which can be used to apply image pattern but is no applicable to apply different icons for the different SegmentedBarItems

    please have a look at the below link

    https://github.com/NativeScript/nativescript-angular/issues/790