简体   繁体   English

react-native:使用徽标时ToolbarAndroid不显示标题

[英]react-native: ToolbarAndroid not displaying title when logo is used

I am not able to display the title when logo is used in toolbar android. 在工具栏android中使用徽标时,我无法显示标题。 Title is displayed in toolbar when logo is not populated. 未填充徽标时,标题显示在工具栏中。

Need logo to be aligned left, followed by title and then settings to the right. 需要徽标向左对齐,然后是标题,然后是右侧设置。 Is it possible? 可能吗?

return (
      <View>
      <ToolbarAndroid style={styles.toolbar}
      logo={require('../images/P.png')}
      title="Toolbar"
      actions={[{title: 'Settings', icon: require('../images/setting.png'),show:'always',showWithText:'true'} ]}
 />
      <Image source={require('../images/P.png')}  style={{width: 40, height: 40}} />

        <Text> This is home page. </Text>


        </View>
    )

var styles = StyleSheet.create({
toolbar: {
    height: 56,
    backgroundColor: '#4883da',
},
});

This is what I see with logo.. 这就是我看到的徽标。

在此处输入图片说明

and here is the screenshot without logo 这是没有徽标的屏幕截图

在此处输入图片说明

Figured out that I used the original image as is without resizing it for app. 弄清楚我按原样使用了原始图像,而没有为应用程序调整其大小。 The image size for the logo should be small(like a icon). 徽标的图像尺寸应较小(如图标)。 When I resized the imaged to 36X36, it worked.. 当我将图像大小调整为36X36时,它可以工作。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM