изображение текущего приложения # my xml file Visual Layout моего приложения
его макет изменяется на разных устройствах
как я могу сделать его гибким, чтобы он мог работать с любым размером экрана одинаково
макет ограничения
<?xml version="1.0" encoding="utf-8"?>
<androidx.constraintlayout.widget.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="@android:color/background_dark"
android:orientation="vertical"
tools:context=".MainActivity">
первый слой калькулятора
<LinearLayout
android:id="@+id/linearLayout2"
android:layout_width="432dp"
android:layout_height="wrap_content"
android:layout_marginStart="10dp"
android:layout_marginLeft="10dp"
android:layout_marginEnd="10dp"
android:layout_marginRight="10dp"
app:layout_constraintBottom_toBottomOf="@+id/LinearLayout5"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintHorizontal_bias="0.2"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="@+id/linearLayout1"
app:layout_constraintVertical_bias="0.036">
<ImageView
android:layout_width="94dp"
android:layout_height="wrap_content"
android:src="@drawable/number7"
tools:layout_editor_absoluteX="318dp"
tools:layout_editor_absoluteY="345dp" />
<ImageView
android:layout_width="109dp"
android:layout_height="wrap_content"
android:src="@drawable/number8"
tools:layout_editor_absoluteX="192dp"
tools:layout_editor_absoluteY="355dp" />
<ImageView
android:layout_width="118dp"
android:layout_height="wrap_content"
android:src="@drawable/number9"
tools:layout_editor_absoluteX="348dp"
tools:layout_editor_absoluteY="395dp" />
<ImageView
android:layout_width="109dp"
android:layout_height="wrap_content"
android:src="@drawable/multi"
tools:layout_editor_absoluteX="16dp"
tools:layout_editor_absoluteY="538dp" />
</LinearLayout>
второй слой калькулятора
<LinearLayout
android:id="@+id/linearLayout1"
android:layout_width="421dp"
android:layout_height="105dp"
android:layout_marginStart="10dp"
android:layout_marginLeft="10dp"
android:layout_marginTop="160dp"
android:layout_marginEnd="10dp"
android:layout_marginRight="10dp"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintHorizontal_bias="0.466"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent"
app:layout_constraintVertical_bias="0.0">
<ImageView
android:id="@+id/imageView"
android:layout_width="89dp"
android:layout_height="wrap_content"
android:clickable="true"
android:focusable="true"
android:src="@drawable/ac"
tools:layout_editor_absoluteX="240dp"
tools:layout_editor_absoluteY="264dp" />
<ImageView
android:layout_width="123dp"
android:layout_height="wrap_content"
android:src="@drawable/doublesign"
tools:layout_editor_absoluteX="119dp"
tools:layout_editor_absoluteY="487dp" />
<ImageView
android:layout_width="115dp"
android:layout_height="wrap_content"
android:src="@drawable/percentage"
tools:layout_editor_absoluteX="100dp"
tools:layout_editor_absoluteY="666dp" />
<ImageView
android:layout_width="94dp"
android:layout_height="wrap_content"
android:src="@drawable/plus"
tools:layout_editor_absoluteX="246dp"
tools:layout_editor_absoluteY="358dp" />
</LinearLayout>
третий слой калькулятора
<LinearLayout
android:id="@+id/LinearLayout3"
android:layout_width="421dp"
android:layout_height="wrap_content"
android:layout_marginStart="10dp"
android:layout_marginLeft="10dp"
android:layout_marginEnd="10dp"
android:layout_marginRight="10dp"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintHorizontal_bias="1.0"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="@+id/linearLayout2"
app:layout_constraintVertical_bias="0.301">
<ImageView
android:id="@+id/imageView12"
android:layout_width="124dp"
android:layout_height="wrap_content"
android:src="@drawable/number4" />
<ImageView
android:id="@+id/imageView9"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:src="@drawable/number5"
tools:layout_editor_absoluteX="164dp"
tools:layout_editor_absoluteY="513dp" />
<ImageView
android:id="@+id/imageView7"
android:layout_width="127dp"
android:layout_height="wrap_content"
android:src="@drawable/number6" />
<ImageView
android:id="@+id/imageView10"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:src="@drawable/minus" />
</LinearLayout>
4-й слой калькулятора
<LinearLayout
android:id="@+id/LinearLayout5"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginStart="10dp"
android:layout_marginLeft="10dp"
android:layout_marginTop="10dp"
android:layout_marginEnd="10dp"
android:layout_marginRight="10dp"
android:layout_marginBottom="36dp"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="@+id/LinerLayout4">
<ImageView
android:id="@+id/imageView2"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:src="@drawable/number0"
tools:layout_editor_absoluteX="26dp"
tools:layout_editor_absoluteY="639dp" />
<ImageView
android:id="@+id/imageView8"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginBottom="16dp"
android:src="@drawable/comma"
app:layout_constraintBottom_toBottomOf="parent"
tools:layout_editor_absoluteX="83dp" />
<ImageView
android:id="@+id/imageView5"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:src="@drawable/equal"
tools:layout_editor_absoluteX="12dp"
tools:layout_editor_absoluteY="639dp" />
</LinearLayout>
и последний ряд калькулятора
<LinearLayout
android:id="@+id/LinerLayout4"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginTop="11dp"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="@+id/LinearLayout3"
app:layout_constraintVertical_bias="0.0">
<ImageView
android:id="@+id/imageView11"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:src="@drawable/number1" />
<ImageView
android:id="@+id/imageView6"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:src="@drawable/number2" />
<ImageView
android:id="@+id/imageView3"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:src="@drawable/number3" />
<ImageView
android:id="@+id/imageView4"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:src="@drawable/divide" />
</LinearLayout>
</androidx.constraintlayout.widget.ConstraintLayout>