javascript - NativeScript Core : I'm trying to change the size of the TabViewItem icon, 无法弄清楚

标签 javascript css xml sass nativescript

我正在为我的 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>

我最好在 iconSource 图像周围添加一些填充,并可能对标题进行一些格式化。 enter image description here

最佳答案

您是否尝试像对待标签一样对待它? 使用标签的属性,如 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/

相关文章:

python - 追加到 XML 标记内的文本

xml - 如何在 XML 模式中定义用户定义数据类型?

javascript - Backbone Collection Where 函数作用于作为对象的属性

javascript - 如何在日期选择器中动态禁用不可用的日期

javascript - 在javascript中出现未定义的错误

javascript - 如果 ie6 做这个其他做那个。我怎样才能做到这一点

html - 手机底部对齐

javascript - 使用自定义 UI 创建 html 框

php数组到xml的转换,即使是嵌套数据

javascript - 从 google 工作表中提取数据并显示为简单的 html 文本