这个问题存在两次:
但是\ n或按strings.xml中的回车都不会在我设置文本的textView中给我换行。有谁知道为什么?
我的textView:
<TextView
android:id="@+id/textView"
android:layout_width="952dp"
android:layout_height="172dp"
android:layout_marginStart="8dp"
android:layout_marginTop="8dp"
android:layout_marginEnd="8dp"
android:layout_marginBottom="8dp"
android:ems="10"
android:inputType="textPersonName"
android:text="@string/give_username"
android:textSize="45sp"
android:textStyle="bold"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent"
app:layout_constraintVertical_bias="0.003" />
我如何设置文字:
this.textView.setText(R.string.give_sex_age);
资源中的字符串:
<string name="give_sex_age">You are a new user.\nPlease give your sex and your age</string>
正如似乎在评论中所说的,amusing是inputType,所以忽略了换行的原因。我只是删除这一行
android:inputType="textPersonName"
现在可以了!
本文收集自互联网,转载请注明来源。
如有侵权,请联系 [email protected] 删除。
我来说两句