如何在同一容器中将标题居中对齐,将文本向左对齐?

时间:2019-02-11 08:32:42

标签: css react-native

嗨,我正在学习本地反应。我正在尝试创建注册表。我需要标题在顶部中央,所有标签字段在左侧。以下是我的代码。

global_list=[]
def rprint(s):
    print(s)
    global_list.append(t[0],t[1],...t[n])  # We don't know how many components in s.

和CSS

>>> global_list, t = [], (1,1)
>>> rprint("[D loss: %f, acc.: %f]" % (t[0], t[1])))
[D loss: 1, acc.: 1]
>>> global_list
[(1,1)]

我面临的问题是我无法同时使标题居中显示和字段标签向左显示。

1 个答案:

答案 0 :(得分:0)

将alignSelf添加到中心。

<ScrollView contentContainerStyle={{ flexGrow: 1 }}
    scrollEnabled >
  <View style={styles.fieldsContainer}>
  <View style={{alignSelf:'center'}}>
  <Text style={styles.headline}>Personal Info</Text>
  </View>
 <Text></Text>
相关问题