skip to Main Content

I am a novice in android app development.
i am trying to do simple title. On design view it looks perfect but at emulator it looks bad and goes off screen.

I used constraintlayout and guidelines to support all screen sizes.

<TextView
android:id="@+id/textView"
android:layout_width="0dp"
android:layout_height="0dp"
android:fontFamily="@font/antoniofont"
android:gravity="bottom"
android:text="@string/app_header"
android:textSize="60sp"
app:layout_constraintBottom_toTopOf="@+id/guideline5"
app:layout_constraintEnd_toStartOf="@+id/guideline2"
app:layout_constraintStart_toStartOf="@+id/guideline6"
app:layout_constraintTop_toTopOf="@+id/guideline7" />

Design view

Emulator

2

Answers


  1. Chosen as BEST ANSWER

    I made some changes and i think it works perfectly. Added -

    app:autoSizeMaxTextSize="70sp"
    app:autoSizeMinTextSize="30sp"
    app:autoSizeStepGranularity="3sp"
    app:autoSizeTextType="uniform"
    

  2. Try this,

    <TextView
        android:id="@+id/textView"
        android:layout_width="0dp"
        android:layout_height="0dp"
        android:fontFamily="@font/antoniofont"
        android:gravity="bottom"
        android:text="@string/app_header"
        android:textSize="60sp"
        app:layout_constraintBottom_toTopOf="@+id/guideline5"
        app:layout_constraintEnd_toEndOf="parent"
        app:layout_constraintStart_toStartOf="parent"
        app:layout_constraintTop_toTopOf="@+id/guideline7" />
    
    Login or Signup to reply.
Please signup or login to give your own answer.
Back To Top
Search