【问题标题】:React Native: how to add icon in tabBar for androidReact Native:如何在 android 的 tabBar 中添加图标
【发布时间】:2017-08-11 00:05:21
【问题描述】:

我想在 tabView 中为 android 添加图标。我的代码看起来:

<ScrollableTabView>
            <View style={styles.container} tabLabel='Menu Button'>
            </View>
            <View style={styles.container} tabLabel='My App'>
            </View>         
            <View style={styles.container} tabLabel='Settings'>
            </View>  
</ScrollableTabView>

我想要图标而不是 菜单按钮设置。 如何使用图标而不是 tabLabel??

【问题讨论】:

    标签: android react-native icons tabview


    【解决方案1】:

    我假设您正在使用: https://github.com/skv-headless/react-native-scrollable-tab-view

    这个解决方案应该有效:

    <ScrollableTabView>
        <View style={styles.container} tabLabel='android-menu'>
        </View>
        <View style={styles.container} tabLabel='My App'>
        </View>         
        <View style={styles.container} tabLabel='android-settings'>
        </View>  
    </ScrollableTabView>
    

    完整的图标列表在这里:

    https://github.com/skv-headless/react-native-scrollable-tab-view/blob/ee5d99950fad9c4c1129d029d7bfaea130df72d1/examples/FacebookTabsExample/android/app/src/main/assets/ion.json

    编辑 1:

    这个例子演示了在 tabLabel 上使用的图标而不是文本: https://github.com/skv-headless/react-native-scrollable-tab-view/tree/master/examples/FacebookTabsExample

    【讨论】:

    • 非常感谢 :)
    猜你喜欢
    • 2021-12-12
    • 1970-01-01
    • 1970-01-01
    • 2021-03-27
    • 1970-01-01
    • 1970-01-01
    • 2021-01-04
    • 2016-01-23
    • 1970-01-01
    相关资源
    最近更新 更多