Проблема с дополнительным интервалом в Android-устройстве с разрешением 4K - PullRequest
0 голосов
/ 22 января 2019

Я занимаюсь разработкой приложения чата для Android.Он работает довольно хорошо на всех устройствах.

Но устройства с разрешением 4K, такие как Samsung s8 + и один плюс 6t, автоматически оставляют дополнительный интервал справа.Я не дал никаких полей и отступов.

см. [this screenshot].

Мой файл просмотра выглядит примерно так:

    <LinearLayout
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:layout_gravity="end"
        android:layout_marginStart="64dp"
        android:layout_marginLeft="64dp"
        android:layout_marginTop="8dp"
        android:layout_marginBottom="8dp"
        android:layout_marginEnd="12dp"
        android:layout_marginRight="12dp"
        android:background="@drawable/sender_bg"
        android:gravity="center_vertical"
        android:orientation="vertical"
        android:padding="16dp">

        <TextView
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:fontFamily="@font/karla_regular"
            android:text="Yes, and it will be safe. My promise"
            android:textColor="@color/colorPrimary"
            android:textSize="16sp" />

    </LinearLayout>
</layout>

может помочь любойя с решением.Заранее спасибо

1 Ответ

0 голосов
/ 22 января 2019

Сделать ширину линейного макета совпадающей с родительской

 <LinearLayout
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:layout_gravity="end"
        android:layout_marginStart="64dp"
        android:layout_marginLeft="64dp"
        android:layout_marginTop="8dp"
        android:layout_marginBottom="8dp"
        android:layout_marginEnd="12dp"
        android:layout_marginRight="12dp"
        android:background="@drawable/sender_bg"
        android:gravity="center_vertical"
        android:orientation="vertical"
        android:padding="16dp">

        <TextView
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:fontFamily="@font/karla_regular"
            android:text="Yes, and it will be safe. My promise"
            android:textColor="@color/colorPrimary"
            android:textSize="16sp" />

    </LinearLayout>
</layout>
...