如何在 android 中将屏幕分辨率设置为 1440 X 2880 和 1440 X 2560?

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

我在 android 中有一个设计,图像在 1440 X 2880 屏幕和 1440 X 2560 屏幕上显示不同。如何正确地做到这一点?特别适用于 1440 X 2880 屏幕。我已经创建了 hdpi、mdpi、xhdpi、xxhdpi、xxxhdpi 图像,但我仍然没有得到结果。

<?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>

图像是在 adobe Xd 工具的帮助下从 .psd 转换为 .png 我需要像第一张快照一样设计图像

根据评论中所说的内容,我认为您的问题来自误解如何使用 android 布局和视图对视图设置约束,而不是您正在处理的屏幕的分辨率.阅读该主题一定会对您有所帮助。

我看到了两种解决您的问题的方法,它们都包括更改您正在使用的布局。一方面,您可以将 RelativeLayout 更改为 LinearLayout 和 google 一些关于视图权重的教程,另一方面,您可以使用更现代的 ConstraintLayout 并阅读关于线性群和链如何工作的一些知识。

我将留下文档链接 here and here 以帮助您入门