Android / Wydajniejszy background

Android / Wydajniejszy background
U6
  • Rejestracja: dni
  • Ostatnio: dni
  • Postów: 40
0

Jaki sposób ustawiania background jest najwydajniejszy. Czy ustawianie tła w ConstraintLayout to dobry pomysł?

Kopiuj
<?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:layout_width="match_parent"
    android:layout_height="match_parent"
    android:background="@drawable/spacebackground"
    tools:context="com.example.user.app.cosmos1">

    <RelativeLayout
        android:layout_width="match_parent"
        android:layout_height="439dp"
        android:layout_marginBottom="8dp"
        android:layout_marginEnd="8dp"
        android:layout_marginStart="8dp"
        android:layout_marginTop="8dp"
        app:layout_constraintBottom_toBottomOf="parent"
        app:layout_constraintEnd_toEndOf="parent"
        app:layout_constraintHorizontal_bias="0.461"
        app:layout_constraintStart_toStartOf="parent"
        app:layout_constraintTop_toTopOf="parent"
        app:layout_constraintVertical_bias="0.96">

        <Button
            android:id="@+id/cosmos11"
            android:layout_width="match_parent"
            android:layout_height="85dp"
            android:layout_alignParentStart="true"
            android:layout_alignParentTop="true"
            android:layout_marginTop="41dp"
            android:background="@drawable/cosmosbutton"
            android:fontFamily="@font/bungee"
            android:text="@string/cosmos1.1"
            android:textAlignment="center"
            android:textColor="#FFFFFF"
            android:textSize="46sp" />
 </RelativeLayout>
</android.support.constraint.ConstraintLayout>
DC
  • Rejestracja: dni
  • Ostatnio: dni
  • Postów: 420
0

Najwydajniej w glownym stylu aplikacji. A potem jak najmniej nadpisywanie. Sprawdz sobie poziom overdraw i generalnie szukaj optymalizacji wtedy kiedy potrzeba faktycznie.

https://developer.android.com/studio/profile/inspect-gpu-rendering#debug_overdraw

Zarejestruj się i dołącz do największej społeczności programistów w Polsce.

Otrzymaj wsparcie, dziel się wiedzą i rozwijaj swoje umiejętności z najlepszymi.