I am developing an android app using the ConstraintLayout
. It shows properly on different screen sizes, however, I would like for the textviews to increase in size and spacing between the elements to take advantage of larger screen real estate on bigger screen phones.
I've read that you can create different XML layouts for different densities or sizes (xxhdpi, xhdpi), but I thought one of the main advantages of ConstraintLayout
over relative layouts was that it would adjust spacing/size automatically. Can you do this with constraint layout, or do you need to create individual xml layouts for each screen size/density? Thanks!
<android.support.constraint.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"
tools:layout_editor_absoluteY="81dp">
<Spinner
android:id="@+id/spinner"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginTop="16dp"
android:layout_marginEnd="8dp"
android:layout_marginBottom="19dp"
android:backgroundTint="@color/colorAccent"
app:layout_constraintBottom_toTopOf="@+id/inView"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toEndOf="@+id/lbsView"
app:layout_constraintTop_toTopOf="parent" />
<TextView
android:id="@+id/weightView"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginStart="27dp"
android:layout_marginTop="21dp"
android:layout_marginEnd="14dp"
android:text="Weight:"
android:textSize="26sp"
app:layout_constraintEnd_toStartOf="@+id/weight"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent" />
This is a sample of my constraint layout.