Search code examples
androidscreenresolution

How to set screen resolution for 1440 X 2880 and 1440 X 2560 in android?


I have one designing in android that images are showing different in 1440 X 2880 screen and 1440 X 2560 screen. How to do this correctly? Specially for the screen 1440 X 2880. I have created hdpi, mdpi,xhdpi,xxhdpi,xxxhdpi images still i am not getting the result.

enter image description here

<?xml version="1.0enter code here" encoding="utf-8"?>
    <RelativeLayout
    xmlns:android="http://schemas.android.com/apk/res/android"
    android:layout_width="match_parent"
    android:layout_height="match_parent">

    <include layout="@layout/view_toolbar_logo"
             android:id="@+id/relToolbar">
    </include>

    <RelativeLayout
        android:layout_width="match_parent"
        android:layout_below="@+id/relToolbar"
        android:layout_marginRight="@dimen/_12sdp"
        android:layout_marginLeft="@dimen/_12sdp"
        android:layout_height="match_parent">
    <ImageView
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:layout_alignParentRight="true"
        android:background="@drawable/test"/>

    <ImageView
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:id="@+id/im1"
        android:background="@drawable/ranking"/>

    <ImageView
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:layout_below="@+id/im1"
        android:layout_marginTop="@dimen/_10sdp"
        android:background="@drawable/coin"/>

    </RelativeLayout>

An images are from the .psd to .png with the help of adobe Xd tool I need design like first snap in image


Solution

  • Based on what has been said on the comments I think your problem comes from misunderstanding how to set constraint to views using android layouts and views, and not from the resolution of the screens you're working on. Reading on the topic will surely help you out.

    I see two solutions to your problem, both of them include changing the layout you're using. On one hand, you could change your RelativeLayout for a LinearLayout and google some tutorial on view weights, and on the other hand you could use the more modern ConstraintLayout and read a little about how linear groups and chains work.

    I'll leave links to the docs here and here to help you get started