我正在为我的 NativeScript 元素中的每个选项卡添加图标,并且我正确地引用了 png 图像,但我的图像有点过大。我正在尝试添加样式,但不知道如何正确引用事物。我正在使用 iconSource 来引用我的图标。
我试过将字体大小更改为 TabView,我试过调整图像大小,我也试过添加填充,但没有任何效果。
<TabViewItem title="Routes" ios:iconSource="res://tabIcons/subway" android:iconSource="res://home">
<Frame defaultPage="home/home-items-page"></Frame>
</TabViewItem>
<TabViewItem title="Map" ios:iconSource="res://tabIcons/map" android:iconSource="res://browse">
<Frame defaultPage="browse/browse-page"></Frame>
</TabViewItem>
<TabViewItem title="Favorites" ios:iconSource="res://tabIcons/heart" android:iconSource="res://search">
<Frame defaultPage="search/search-page"></Frame>
</TabViewItem>
<TabViewItem title="Settings" ios:iconSource="res://tabIcons/cog" android:iconSource="res://settings">
<Frame defaultPage="settings/settings-page"></Frame>
</TabViewItem>
</TabView>
最佳答案
您是否尝试像对待标签一样对待它? 使用标签的属性,如 width="100"height="100"stretch="aspectFill"等...
这里有更多关于图像组件的信息 https://docs.nativescript.org/ui/ns-ui-widgets/image
编辑: 如果它不起作用,然后尝试实现自定义底部导航而不是 tabview,它更灵活,跨平台的 UI 更统一,就像这个 https://play.nativescript.org/?template=play-tsc&id=R2y34S&v=11
关于javascript - NativeScript Core : I'm trying to change the size of the TabViewItem icon, 无法弄清楚,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/56639807/