Nativescript-slides滑块内容重叠

时间:2017-11-24 07:57:51

标签: nativescript angular2-nativescript

我正在创建android原生应用程序。我是nativescript的新手。我要求创建动态幻灯片屏幕,屏幕上有很多内容,我在谷歌搜索,我在下面找到链接nativescript-slides

我浏览了这个链接,并创建了以下代码

slides.html

<Slides:SlideContainer angular="true" id="slides" #slides pageIndicators="true" changed="changeSlides">
    <Slides:Slide class="slide" *ngFor="let player of players">
        <Label [text]="player.name"></Label>
    </Slides:Slide> 
</Slides:SlideContainer>

slides.component.ts

import {registerElement} from "nativescript-angular/element-registry";
registerElement("Slide", () => require("nativescript-slides").Slide);
registerElement("SlideContainer", () => require("nativescript-slides").SlideContainer);

export class SlidesComponent implements OnInit {
    players : Array<Player> = [];
    @ViewChild("slides") slides: ElementRef;
    ngOnInit() {
        this.handlePlayer();
    }
    ngAfterViewInit() {
        let SlidesXml = this.slides.nativeElement;
        SlidesXml.constructView();
    }
    handlePlayer() {
        //Call api and get data
        this.players = data;
    }    
}

但是当我执行tns run android时,我得到了以下回复(重叠所有玩家名称)

enter image description here

那么我该如何解决这个问题?

0 个答案:

没有答案