小编shi*_*c40的帖子

反应本机顶部标签栏导航器:指示器宽度以匹配文本

我在顶部标签栏导航中有三个具有不同宽度文本的选项卡。是否可以使指示器宽度与文本匹配?类似地,如何使选项卡也与文本的宽度匹配而不使其显示奇怪。我尝试过自动宽度,但它不保持居中。

这是使用自动宽度时的样子: 在此输入图像描述

    <Tab.Navigator 
                initialRouteName="Open"
                tabBarOptions={{
                    style: { 
                      backgroundColor: "white", 
                      paddingTop: 20, 
                      paddingHorizontal: 25
                      },
                    indicatorStyle: {
                      borderBottomColor: colorScheme.teal,
                      borderBottomWidth: 2,
                      width: '30%',
                      left:"9%"
                    },
                    tabStyle : {
                      justifyContent: "center",
                      width: tabBarWidth/3,
                    }
                  }}
            >
                <Tab.Screen 
                    name="Open" 
                    component={WriterRequestScreen} 
                    initialParams={{ screen: 'Open' }} 
                    options={{ 
                      tabBarLabel: ({focused}) => <Text style = {{fontSize: 18, fontWeight: 'bold', color: focused? colorScheme.teal : colorScheme.grey}}> Open </Text>, 
                   }}
                    />
               <Tab.Screen 
                    name="In Progress" 
                    component={WriterRequestScreen} 
                    initialParams={{ screen: 'InProgress' }}
                    options={{ 
                      tabBarLabel: ({focused}) => <Text style = {{fontSize: 18, fontWeight: 'bold', …
Run Code Online (Sandbox Code Playgroud)

react-native react-navigation

5
推荐指数
2
解决办法
9766
查看次数

如何在材质UI中居中放置按钮

我不知道如何在材料ui中居中放置按钮。这是我的代码:

function BigCard(props) {
    const { classes } = props;
    return (
    <div>
        <Card className={classes.card}>
        <CardContent>
            <Typography variant="display1" className={classes.title}>
            Start Funding!
            </Typography>
        </CardContent>
        <CardActions >
            <Button size="small" color="primary" className={classes.actions}>
            Share
            </Button>
            <Button size="small" color="primary">
            Learn More
            </Button>
        </CardActions>
      </Card>
    </div>
  );
Run Code Online (Sandbox Code Playgroud)

如何将按钮居中?

css button alignment material-ui

2
推荐指数
6
解决办法
1万
查看次数