标签: nativescript-codesharing

Angular + Nativescript 代码共享项目移除操作栏

我的项目正在使用 Angular + Nativescript 代码共享项目为 Android 和 IOS 的 web 以及移动构建。

问题是试图删除整个应用程序的操作栏。我已经阅读了一些关于这个问题的帖子,但是似乎没有一个解决方案有效,或者至少最终不是一个很好的解决方案。

我试图添加<Page actionBarHidden="true"></page>但是这app.component在包含路由的其他组件中或在其他组件中根本不起作用,例如 a home.componentwith the route home。如:

<Page actionBarHidden="true">
  <StackLayout orientation="vertical">
    <Image src="res://buy" stretch="none" horizontalAlignment="center"></Image>
  </StackLayout>
</Page>
Run Code Online (Sandbox Code Playgroud)

我还尝试了一种专门针对 android 的方法,看看我是否可以通过AndroidManifest.xml文件解决这个问题,就像我通过更新 android 清单来删除操作栏来制作本机 Android 应用程序一样。对于健全性测试,我还尝试通过以下方式使用它styles.xml

<style name="AppThemeNoActionBar" parent="AppTheme">
    <item name="windowActionBar">false</item>
    <item name="windowNoTitle">true</item>
</style>
Run Code Online (Sandbox Code Playgroud)

在这些失败的尝试之后,我尝试了其他人推荐的以下代码,Page例如:

import { Page } from 'tns-core-modules/ui/page';

@Component({
  selector: 'app-root',
  templateUrl: './app.component.html',
  styleUrls: ['./app.component.scss']
})
export class AppComponent implements OnInit {

  ngOnInit() {
    this.page.actionBarHidden …
Run Code Online (Sandbox Code Playgroud)

android-actionbar nativescript angular nativescript-codesharing angular-nativescript

1
推荐指数
1
解决办法
888
查看次数