Issue
This question exist two times :
Line break \n doesn't work, it show as string
String Resource new line /n not possible?
But neither \n or hit enter in strings.xml gives me a line break in the textView that i set the text. Does anyone knows why?
My 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" />
How i set the text:
this.textView.setText(R.string.give_sex_age);
The string in resources:
<string name="give_sex_age">You are a new user.\nPlease give your sex and your age</string>
Solution
As seeming.amusing said in the comments it was the inputType the reason that line break are ignored. I just delete this line
android:inputType="textPersonName"
Now it works!
Answered By - Thelouras
0 comments:
Post a Comment
Note: Only a member of this blog may post a comment.