在 Nativescript 中,有没有办法通过 id 获取 ActionBar 中的操作项?

In Nativescript, is there any way to get an action item in ActionBar by id?

我正在使用 NativeScript 1.5,似乎无法通过 ID 查看 ActionBar 中的项目。

也许我做错了。任何建议将不胜感激。

不,你不能通过 id 获取它,无论如何它只有一个,你可以从页面以编程方式获取它 (args.object)。您可以使用 xml 中的 ActionBar.titleView 来玩操作栏,您甚至可以在其中放置布局 (StackLayout) 更改高度、排列项目等。

看起来它在 iOS 的 1.6 中有效,但在 android 上崩溃,下周的 1.7 应该会解决它

https://github.com/NativeScript/NativeScript/issues/1691