Skip to content
Advertisement

How to adjust Text Views in different Screens (Android Studio)

I’ve search for all Internet but can’t figure this out, i have my textviews on my Images, when I rotate the phone or change to other screen size, the Text won’t adapt like i want (left image) i already tried app:autoSizeTextType=”uniform”, wrap content, match parent, but this won’t do.

Image

my xml

    <TextView
                android:id="@+id/txt_chaves"
                android:layout_width="wrap_content"
                android:layout_height="wrap_content"
                android:gravity="center"
                android:shadowColor="#000000"
                android:shadowDx="7"
                android:shadowDy="6"
                android:shadowRadius="1.6"
                android:textSize="30sp"
                android:text="Chaves"
                android:textColor="#ffffff"
                android:textStyle="bold"
                app:layout_constraintBottom_toTopOf="@+id/gd_end_imgs1"
                app:layout_constraintEnd_toStartOf="@+id/gd_foto_esq_dir"
                app:layout_constraintStart_toStartOf="@+id/gd_foto_esq_esq"
                app:layout_constraintTop_toTopOf="@+id/gd_start_imgs1"
                app:layout_constraintVertical_bias="0.0" />

<com.google.android.material.imageview.ShapeableImageView
                android:id="@+id/img_chaves"
                android:layout_width="0dp"
                android:layout_height="0dp"
                android:adjustViewBounds="true"
                android:clickable="true"
                android:onClick="NextChaves"
                android:scaleType="fitXY"
                app:layout_constraintBottom_toTopOf="@+id/gd_end_imgs1"
                app:layout_constraintDimensionRatio="1:1"
                app:layout_constraintEnd_toStartOf="@+id/gd_foto_esq_dir"
                app:layout_constraintHorizontal_bias="1.0"
                app:layout_constraintStart_toStartOf="@+id/gd_foto_esq_esq"
                app:layout_constraintTop_toTopOf="@+id/gd_start_imgs1"
                app:layout_constraintVertical_bias="0.0"
                app:shapeAppearanceOverlay="@style/RoundImage"
                app:srcCompat="@drawable/chaves" />

Advertisement

Answer

You can create a new layout for landscape mode.

you can create one by right clicking on the res directory

New -> Android resource directory

New -> Android resource directory and filling out the prompt below.

and you can take a look at this one.

User contributions licensed under: CC BY-SA
7 People found this is helpful
Advertisement