Regardless of the model, I would like to make the text length full of the screen, whether vertically or horizontally on my smartphone.What should I do?
This is a regular TextView.
Tried
<TextView
android: id="@+id/main_text_view"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_centerInParent="true"
android:layout_gravity="center"
android:text="Start"
android:autoSizeTextType="uniform"
android: textColor="@color/colorBlack"/>
I want to fill up the middle of the screen and the full screen, but it appears small in the upper left corner.
android
main_activity.xml:
<androidx.constraintlayout.widget.ConstraintLayout
xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent"
tools:context=".MainActivity">
<TextView
android:layout_width="0dp"
android:layout_height="0dp"
android:autoSizeMaxTextSize="300sp"
android:autoSizeTextType="uniform"
android:gravity="center_vertical"
android:maxLines="1"
android:text="Hello!"
app:layout_constrainBottom_toBottomOf="parent"
app:layout_constrainLeft_toLeftOf="parent"
app:layout_constrainRight_toRightOf="parent"
app:layout_constrainTop_toTopOf="parent"/>
</androidx.constraintlayout.widget.ConstraintLayout>
© 2024 OneMinuteCode. All rights reserved.