在 Nativescript-Angular TabView 上隐藏选项卡按钮

Hide tab buttons on Nativescript-Angular TabView

我正在尝试找到一种方法来删除带有 Angular 6 应用程序的元素上的选项卡按钮,但目前无济于事。基本上,我只想保留选项卡内容及其滑动功能。

显然可以使用特定的 android 和 iOS 方法,但我不确定该怎么做。

<TabView [(ngModel)]="tabSelectedIndex" (selectedIndexChanged)="onSelectedIndexChanged($event)" (loaded)="tabViewLoaded($event)">
    <ng-container *ngFor="let article of articles" #tabView>
        <StackLayout *tabItem="{title: article.id}">
            <StackLayout>
                <NewsDetails></NewsDetails>
            </StackLayout>
        </StackLayout>
    </ng-container>
</TabView>

在我的 .ts 文件中,我可以找到对元素的引用,如下所示:

@ViewChild("tabView") tabView: ElementRef;

ngAfterViewInit() {
    console.dir(this.tabView.nativeElement);
}

但我不知道从现在开始该做什么。有任何想法吗?之前所有关于此的问题均无效。

这是一个示例游乐场 link:https://play.nativescript.org/?template=play-ng&id=iK9ZTM

将下面的代码与 TabView 的加载事件一起使用。

onTabViewLoaded(event: EventData) {
   const tabView = <TabView>event.object;
   if (isIOS) {
     tabView.viewController.tabBar.hidden = true;
   }
   if (isAndroid) {
     const tabLayout = tabView.nativeViewProtected.tabLayout;
     tabLayout.getLayoutParams().height = 0;
     tabLayout.requestLayout();
   }
}

我最近在 Uplabs

中发布了一个示例作品