1
我對Text
的樣式有問題,我有兩行Text
,文本的第一行在行的中心顯示正確,但代碼的第二行不在中心。如何解決這個問題?Text的第二行不在行的中心呈現
<View style={{ flex: 1, justifyContent: 'center', alignItems: 'center', flexDirection: 'row' }}>
<Text
style={{ marginLeft: 5, fontWeight: '500', fontFamily: 'Arial', fontSize: ratio * 14, color: '#3c3c3c' }}
numberOfLines={2} > {title}
</Text>
</View>
您需要在文本組件中使用{textAlign:'center'}。 –
謝謝,有幫助,請把它寫成答案,我可以接受! –