ios - 文本输入垂直对齐
<p><p>有人知道如何使用自定义字体(内容和占位符)修复 TextInput 的垂直对齐吗?我尝试了所有这些:</p>
<ul>
<li>justifyContent:“中心”,</li>
<li>alignItems:'居中',</li>
<li>textAlign: '居中',</li>
<li>textAlignVertical: ‘居中’,</li>
</ul>
<p>没有任何作用!有什么建议吗?</p>
<p> <a href="/image/KT5X9.png" rel="noreferrer noopener nofollow"><img src="/image/KT5X9.png" alt="enter image description here"/></a> </p>
<pre><code> <TextInput
ref={ref => this.emailField = ref}
placeholder="E-Mail"
style={styles.loginInput}
placeholderStyle={styles.loginInput}
editable={true}
maxLength={40}
autoCorrect={false}
selectionColor="#9D9D9D"
placeholderTextColor="#9D9D9D"
autoCapitalize="none"
keyboardType="email-address"
returnKeyType="next"
keyboardAppearance="dark"
textAlign="center"
underlineColorAndroid="transparent"
onSubmitEditing={() => this.passwordField.focus()}
value={this.state.email}
onChangeText={(text) => this.setState({ email: text })}
/>
loginInput: {
width: '70%',
height: 40,
marginBottom: 8,
backgroundColor: '#dbdbdb',
fontFamily: 'Neuzeit Grotesk Regular',
fontSize: 18,
justifyContent: 'center',
alignItems: 'center',
textAlign: 'center',
textAlignVertical: 'center',
},
</code></pre></p>
<br><hr><h1><strong>Best Answer-推荐答案</ strong></h1><br>
<p><p>我遇到了同样的问题。 TextInput 有一个默认的填充,
就我而言。我在 <code>TextInput</code> 样式中添加了 <code>paddingTop: 0</code>, <code>paddingBottom: 0</code>。</p></p>
<p style="font-size: 20px;">关于ios - 文本输入垂直对齐,我们在Stack Overflow上找到一个类似的问题:
<a href="https://stackoverflow.com/questions/50064386/" rel="noreferrer noopener nofollow" style="color: red;">
https://stackoverflow.com/questions/50064386/
</a>
</p>
页:
[1]