0

I want different layouts for different Android phone screen size. I created a layout activity_main(h320dp-small) for small screen size, but both the devices one having height, width(1080, 2016) and other one is having height, width(1080, 2290) is showing the same layout(h320dp-small)

<?xml version="1.0" encoding="utf-8"?>
<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="wrap_content"
        android:layout_height="wrap_content"
        android:text="Hello World from small"
        app:layout_constraintBottom_toBottomOf="parent"
        app:layout_constraintEnd_toEndOf="parent"
        app:layout_constraintStart_toStartOf="parent"
        app:layout_constraintTop_toTopOf="parent" />

</androidx.constraintlayout.widget.ConstraintLayout>

How can I resolve this issue, so that I can use different layouts in my different screen size devices?

  • Does this answer your question? [How to define dimens.xml for every different screen size in android?](https://stackoverflow.com/questions/32860815/how-to-define-dimens-xml-for-every-different-screen-size-in-android) – gioravered May 31 '23 at 14:46

0 Answers0