Пиксель 2 XL против Nexus 5x
Я пытаюсь масштабировать свой собственный ListView по нескольким разрешениям, но я сталкиваюсь с этой проблемой: у меня есть лишние пробелы на Pixel 2 XL, который является устройством 1440p, но он отлично смотрится на Nexus 5X, который устройство 1080p.
Прилагается XML-код, который у меня есть как для фрагмента, так и для ListView. Я использую ConstraintLayout для фрагмента и RelativeLayout для ListView. Я пытался использовать ConstraintLayout для ListView, но у меня возникли проблемы с привязкой моего второго текстового представления к правой стороне.
ListView XML
<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout 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:id="@+id/linearLayout"
android:layout_width="match_parent"
android:layout_height="match_parent">
<TextView
android:id="@+id/textView1"
android:layout_width="68dp"
android:layout_height="wrap_content"
android:gravity="start"
android:text="TextView"
android:textSize="18sp" />
<TextView
android:id="@+id/textView2"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentStart="true"
android:layout_alignParentTop="true"
android:layout_marginStart="310dp"
android:layout_marginTop="0dp"
android:gravity="end"
android:text="TextView"
android:textSize="18sp" />
</RelativeLayout>
Фрагмент XML
<?xml version="1.0" encoding="utf-8"?>
<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:id="@+id/frameLayout2"
android:layout_width="match_parent"
android:layout_height="match_parent"
tools:context=".LeaderboardFrag">
<!-- TODO: Update blank fragment layout -->
<ListView
android:id="@+id/leaderboardListView"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent"
/>
</android.support.constraint.ConstraintLayout>